abcd wrote:

> def foo():
>     import bar
>     bar.printStuff()
> 
> foo()
> foo()
> foo()
> foo()
> 
> ...will that re-import bar 4 times...or just import it once?  is this a
> big performance hit?
> 
> thanks
> 

Given a file called bar.py with the following contents:

print "I'm being imported!"

def printStuff():
     print 'stuff'

I get this output when I import foo.py:

 >>> import foo
I'm being imported!
stuff
stuff
stuff
stuff
 >>>


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to