An AA kit with either of those guns would be great. A bit expensive but great. They can be a bit hard to find sometimes, and mags can be had online fairly cheaply if you look. I have AA kits (22 LR) for both my 27 and 23. It is a simple swap. It allows you to shoot 22 LR with the same lower and focus on trigger, etc without the cost and with somewhat less recoil.
That said, if you are a new shooter, I'd opt for the 26, and would actually probably suggest a 19. The 19/23 is just about as easy to carry as the 26/27 and is easier to shoot well than the subcompact, in my opinion.
The 9mm is easier recoiling, a bit cheaper to shoot (depending on where you get your ammo), and just a bit easier to shoot better IMO, than the .40. If you feel really strongly about the .40 I'm not trying to keep you away from it, but if you don't have a preference, go for the 9 (this from a guy who has a Glock 27/23/30 )
One difference between 9mm and .40 is noise. The .40 is much louder when fired. I heard cops say the like the noise made by .40. People know it was a gun shot and run from it. A .40 clears the streets. By comparison, a 9mm makes a sound that attracts people. Was the a car backfiring? What was that noise?
Have you shot both? If not, try them out before you buy. Ranges rent guns and gun owners are generally happy to help new owners.
Once you buy your gun the next step is training. The events in which you might use a gun are stressful. Training for that stress is necessary.