import vs from module import : any performance issue?

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


Q1:
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?

Q2:
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?

Q3:
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?


Thanks

Pierre




More information about the Python-list mailing list