
"Guido van Rossum" <guido@python.org> wrote in message news:200310212340.h9LNeYq25691@12-236-54-216.client.attbi.com...
Eek. Global statement inside flow control should be deprecated, not abused to show that global is evil. :-)
Is there any good reason to ever use globals anywhere other than as the first statement (after doc string) of a function? If not, could its usage be so restricted (like __future__ import)?
Plus. EVERY newbie makes the mistake of taking "global" to mean "for ALL modules" rather than "for THIS module",
Part of my brain still thinks that, and another part has to say, 'no, just modular or mod_vars()'.
Only if they've been exposed to languages that have such globals.
Like Python with __builtins__? which I think of as the true globals. Do C or Fortran count as such a source of 'infection'?
uselessly using global in toplevel,
Which the parser should reject.
Good. The current nonrejection sometimes leads beginners astray because they think it must be doing something. While I use global/s() just fine, I still don't like the names. I decided awhile ago that they must predate import, when the current module scoop would have been 'global'.
[from another post] But I appreciate the argument; 'global' comes from ABC's >SHARE, but ABC doesn't have modules.
Aha! Now I can use this explanation as fact instead of speculation. Terry J. Reedy