Global variables in modules...

2008-03-28 Thread ttsiodras
With a.py containing this:

== a.py ===
#!/usr/bin/env python
import b

g = 0

def main():
global g
g = 1
b.callb()

if __name__ == "__main__":
main()
==

...and b.py containing...

= b.py =
import a, sys

def callb():
print a.g
==

...can someone explain why invoking a.py prints 0?
I would have thought that the global variable 'g' of module 'a' would
be set to 1...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Global variables in modules...

2008-03-28 Thread ttsiodras
That clears it up. Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list