[Python-Dev] Advice in stat.py

Fred L. Drake, Jr. fdrake@acm.org
Mon, 30 Jul 2001 01:23:39 -0400 (EDT)

Aahz Maruch writes:
 > If you have a single module that imports all four of these (and I don't
 > think that's particularly bizarre), tracing back any random symbol to

  Only if you import-* them all, and that *is* a pathelogical case.
Any time you import-* *two* modules, you have a pathelogical case on
your hands, just ready to explode.

 > It just plain goes against "explicit is better than implicit".  I think
 > we should declare a universal policy of NEVER recommending import *,
 > except for interactive use.

  I'd be willing to give it up even there, esp. now that we have

Barry sez:
 > There are often good reasons to use import-* at the module global
 > level.  Mailman has two places where this is used effectively.  The
 > more interesting place is in a configuration file called mm_cfg.py.
 > This file is where users are supposed to put all their customizations
 > overriding out-of-the-box defaults.  At the top of the file there's a

  This is about the only kind of thing I've ever found it useful for:
re-implementing a module's interface, but when I only want to change a
few things.  Needing to do this never feels like a good solution, and
probably indicates that some object needs to accept a parameter that
offers the module's interface instead of finding it by name.
  So yeah, I'd give up import-*.


Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation