Do more imported objects affect performance

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Tue Dec 2 08:08:05 EST 2008


Nick Craig-Wood a écrit :
> On Tue, Dec 02, 2008 at 11:24:29AM +0600, Taskinoor Hasan wrote:
>> On Mon, Dec 1, 2008 at 8:21 PM, Filip Gruszczy?ski <gruszczy at gmail.com>wrote:
>>
>>> I see. Thanks for a really good explanation, I like to know, how to do
>>> things in the proper way :)
>> I always prefer to use import module and then use module.function. The
>> reason is simple. It makes the code more readable and maintainable.
> 
> I prefer the "from module import function".  That means that if
> "module" doesn't supply "function" it raises an exception at compile
> time, not run time when you try to run "module.function".

Nope. import is an executable statement, and ImportError happens at 
runtime too.




More information about the Python-list mailing list