Do more imported objects affect performance

Rafe rafesacks at gmail.com
Mon Dec 1 03:30:03 EST 2008


On Dec 1, 7:26 am, "Filip Gruszczyński" <grusz... at gmail.com> 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?
>
> --
> Filip Gruszczyński

Why use it if you don't need it? Your post implies a choice and the
'*' import can really make things muddy if it isn't actually necessary
(rare). Why not just import the module and use what you need? It is
way easier to read/debug and maintains the name-space.

- Rafe



More information about the Python-list mailing list