import from question

iu2 israelu at elbit.co.il
Mon Jan 14 16:22:47 EST 2008


Hi all

I've got three files:

file a1.py:
========
the_number = None

file a2.py:
========
import a1

def init():
    a1.the_number = 100

file a3.py:
========
from a1 import the_number
import a2

a2.init()
print the_number, type(the_number)

Runninr a3.py I get:
None <type 'NoneType'>

Changing a3.py to:
import a1
import a2

a2.init()
print a1.the_number, type(a1.the_number)

gives:
100 <type 'int'>

Why doesn't it work in the first version of a3.py?

Thanks,
iu2



More information about the Python-list mailing list