Module trouble [newbie]

Diez B. Roggisch deets at nospam.web.de
Fri Feb 23 06:55:10 EST 2007


Boris Ozegovic wrote:

> Can somebody explaint this to me:
> 
> I have module a.py
> A = 100
> import b
> print "A printing"
> print "B is %s" % b.B
> 
> and module b.py
> B = 2000
> import a
> print "B printing"
> print "A is %s" % a.A
> 
> I thought that output would be:
> B printing
> A is 100
> A printing
> B is 2000
> 
> Because import b would execute b.py, and in b.py line "import a" would be
> ignored, but my output is:
> 
>>>> import a
> 100
> A printing
> B is 100

Are you sure the above is what you really used for your test? Because your
output features a single 100, which the above lacks a print-statement for.


Diez



More information about the Python-list mailing list