Python Library Question

Markus Schaber markus at schabi.de
Sun Aug 26 16:34:04 EDT 2001


Hi,

Jeff Shannon <jeff at ccvcorp.com> schrub:

>> As you know, there's always _one_ obvious way to do it, but this only
>> way may have just lots of lanes :-)
> 
> True, though I think the phrase was "at least one, and preferably only
> one",
> but that's splitting hairs.  :)

That is the _famous_ phrase - maybe mine gets as famous as well :-)

> Personally, I greatly prefer the original, explicit form--it's much
> easier to read and keep track of, especially when trying to read a
> longish script written by someone else (and as a side benefit, is more
> amenable to reload()
> if that is ever necessary).  So I would try to encourage people,
> especially newbies, to use that form rather than "from x import y",
> and strongly
> discourage "from x import *" of course.  :)  Of course this is
> personal opinion, and there are specific cases where these guidelines
> do not apply, but then, there's an exception to every rule...

Of course, the first solution has lots of advantages (and I usually 
also prefer it), but the second solution has the advantage that the 
code of the OP doesn't have to be changed except the import statement.

markus
-- 
1) Customers cause problems.
2) Marketing is trying to create more customers.
Therefore:
3) Marketing is evil.  (Grand Edwards in comp.lang.python)



More information about the Python-list mailing list