> "Peter" == Peter Otten <[EMAIL PROTECTED]> writes:
Peter> [EMAIL PROTECTED] wrote:
[snip]
>> ...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...
Peter> When you run a.py as a script it is put into the s
That clears it up. Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> 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...
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():