Do more imported objects affect performance
MRAB
google at mrabarnett.plus.com
Sun Nov 30 20:09:53 EST 2008
Filip Gruszczyński wrote:
> I have following question: if I use
>
> from module import *
>
> instead
>
> from module import Class
>
> am I affecting performance of my program? I believe, that all those
> names must be stored somewhere, when they are imported and then
> browsed when one of them is called. So am I putting a lot of "garbage"
> to this storage and make those searches longer?
>
Importing many (or all) names will take longer than importing a few, but
you probably won't notice the difference.
You'll also be filling the namespace with a lot of unwanted names.
Will it affect how long it takes to look up a name? No.
More information about the Python-list
mailing list