Where to place imports

Diez B. Roggisch deets at nospam.web.de
Fri Jan 23 12:52:13 EST 2009


John [H2O] schrieb:
> So it isn't inefficient to import a bunch of modules that may not be used,
> say if only one function is used that doesn't rely on a larger module like
> numpy or pylab?

Well, importing can take bit of time - but that's a short latency at 
startup-time, if anything.

And if your module gets imported inside a function, it *is* used, isn't it?

Diez



More information about the Python-list mailing list