I'm confused. I was just reading the URL below..

http://jaynes.colorado.edu/PythonGuidelines.html

and this statement confused me: "Always use from module import Name, Name2, 
Name3.. syntax instead of import module or from module import *. This is more 
efficient, reduces typing in the rest of the code, and it makes it much easier 
to see name collisions and to replace implementations."

To me, import module is more explicit.
It seems to easier to read CoolModule.niceFunction() than just niceFunction(). 
You know exactly where niceFunction comes from especially when you've imported 
many modules. Don't you avoid namespace pollution too by using import module 
instead of from module import * or from module import Name, Name2, Name3...?

What is the preferred/better way to import modules?

Mike
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to