The best (read: Snarkiest ) answer I've heard is "too many to count".
Hypothetically, if you shoot USPSA, you might want up to 5 for use in matches, maybe with special basepads. You might also want some relatively low-use ones, maybe three, in the original box, "in case" you want to unload the gun. And then maybe some for range use, if you hate to load mags at the range.
For a strictly carry gun, you might want a couple carry mags (one in the gun, one reload), a "Barney" mag that you use to load up. and whatever "extras" you might want for range visits, so you aren't loading and unloading carry ammo in the primary mags.
I find Glock mags are pretty robust. Hell, you need a Jaws of Life just to take one apart. I've never worn one out.