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
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
"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.
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
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