module not callable - why not?

Paul Prescod paul at prescod.net
Fri Apr 9 20:15:03 EDT 2004


Terry Reedy wrote:
 > ...
>>from quaternion import quaternion
>>would solve that - but AFAIK thats considered bad for some reasons.
> 
> 
> By who?  and why would you let whoever override your preference ;-)
> I have only read suggestions that one be careful with from x import *.

If you use the "import from X from Y" form you need to understand the 
implications. It isn't just a shorter way of referring to Y. You're also 
removing a level of indirection that you have when you refer to it via 
X.Y. This means that if someone rebinds X.Y you won't see that. 
Typically you don't care but in some cases you might.

  Paul Prescod





More information about the Python-list mailing list