Re: Don't understand global variables between modules

2005-02-23 Thread Bart van Deenen
Hi thanks for the answer. Coming from C and C++ this behaviour wasn't really obvious to me. I still love Python though :-) Most elegant language I've ever seen. Bart -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't understand global variables between modules

2005-02-23 Thread Bart van Deenen
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > because running a script isn't the same thing as importing it. try adding > "print __name__" lines before your other print statements so you can see > who's printing what. > > > Is there more than one global space? > > in this case, there are more modu

Re: Don't understand global variables between modules

2005-02-21 Thread Terry Reedy
"Bart" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I don't understand globals between multiple modules in a python program. Because there are not any. All names are bound to objects in a module global namespace, a function local namespace, or an object attribute namespace.

Re: Don't understand global variables between modules

2005-02-21 Thread Fredrik Lundh
Bart wrote: > I don't understand globals between multiple modules in a python program. I > really don't. I've narrowed it down to the following two very simple > programs a.py and b.py. When I run a.py I get the following output: > > inc: 2 > A: 2 > inc: 3 > B: 3 > C: 1 > > I don't understand

Don't understand global variables between modules

2005-02-21 Thread Bart
Hi all I don't understand globals between multiple modules in a python program. I really don't. I've narrowed it down to the following two very simple programs a.py and b.py. When I run a.py I get the following output: inc: 2 A: 2 inc: 3 B: 3 C: 1 I don't understand the last line at all. Why