global variable scope
Rene Pijlman
reageer.in at de.nieuwsgroep
Sat Feb 8 18:29:47 EST 2003
Sam Marrocco:
>Is it possible to make a variable "super-global", meaning that it is
>visible to *all* modules of a python program (I'm well aware of the
>pitfalls to such techniques)?
The funny thing about Python is that a variable doesn't have to
be in static scope to be able to reference it. You can bring it
into scope dynamically.
# foo.py
superglobal = 1
# bar.py
from foo import superglobal
print superglobal
--
René Pijlman
Wat wil jij leren? http://www.leren.nl
More information about the Python-list
mailing list