import vs from module import : any performance issue?

Pierre Rouleau prouleau at
Sat Mar 6 05:55:27 CET 2004

I'v seen mentionned in some post that there could be performance issues 
of using:

	from moduleX import whatever

as opposed to:

	import moduleX

What would be the performance issues?

What happens when names from moduleX are imported using the first former 
syntax in some modules of an application and imported using the latter 
syntax in other modules of the same application?

It's my understanding that using the "from moduleX import whatever" 
syntax in moduleA, all of moduleX code will run and only the name 
"whatever" will be made available to moduleA.  What are the benefit of 
using this syntax then, is it only the fact that you don't have to type 
the "moduleX." prefix in moduleA?



More information about the Python-list mailing list