"John Bokma" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>> def foo():
>>     import bar
>>     bar.printStuff()
> I am new to Python so this might be a weird question, but it there a
> reason why you import bar inside foo?

Two possible reasons:
1) delay import until actually needed, if ever.
2) put 'bar' into the function local namespace instead of the module global 
namespace

Terry Jan Reedy



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

Reply via email to