Steven D'Aprano a écrit :
(snip)
> I do take your point that importing * has the potential to unexpectedly
> clobber names you didn't intend,

Another problem is that it makes harder to know from which module a name 
comes from.

> and that's a good reason to avoid it
> unless you have a good reason to use it. But there are good reasons.
> 
> The "from module import *" statement is very useful if you wish to export
> all the public objects from a "private" module, e.g. emulate what the os
> module does with platform specific functions.

Indeed.

(snip)

> I certainly agree that "from module import *" is easily abused, but to go
> from there to the conclusion that it is a blight that must be stamped out
> is far too strong.

As with any "you shall not..." programming rule (goto's, multiple return 
points, public attributes, etc, etc), it stands as long as you don't 
fully understand when and why it's ok to do it.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to