import from question

Duncan Booth duncan.booth at invalid.invalid
Tue Jan 15 04:08:06 EST 2008


iu2 <israelu at elbit.co.il> wrote:

> file a3.py:
>========
> from a1 import the_number
> import a2
> 
...
> 
> Why doesn't it work in the first version of a3.py?
> 
Think of 'import a2' as being the same as:

a2 = __import__('a2')

and 'from a1 import the_number' as roughly the same as:

the_number = __import__('a1').the_number

In other words think of them as assignments and it should all make sense.




More information about the Python-list mailing list