er wrote:
Simple question, I think: Is there a way to make a completely global
variable across a slew of modules? If not, what is the canonical
way to keep a global state? The purpose of this is to try to prevent
circular module imports, which just sort of seems nasty. Thank you!
Simple answer: no.
You can put your global state into a module which is imported wherever
it's needed:
my_globals.py
-------------
foo = ""
module_1.py
-----------
import my_globals
...
my_globals.foo = "FOO"
...
module_2.py
-----------
import my_globals
...
print my_globals.foo
...
--
http://mail.python.org/mailman/listinfo/python-list