[Python-Dev] Relative import

Andrew Bennetts andrew-pythondev at puzzling.org
Thu Dec 18 00:10:21 EST 2003

On Wed, Dec 17, 2003 at 08:55:03PM -0800, Guido van Rossum wrote:
> -- that's currently impossible.  But the most common variant I've seen
> is what Tim Peters describes: having a module in the current directory
> that accidentally hides a standard module.
> The latter case does not involve packages and will not be fixed by any
> import syntax -- it can only be fixed by changing the default sys.path
> *not* to include the current directory, just like over the last decade
> or so Unix shells have stopped putting '.' in $PATH.

Or it can be fixed by not having the entire standard library at the
toplevel, but instead inside a single "stdlib" package.  That way 3rd party
packages could never conflict with the standard library (unless they were
crazy enough to call one of their own modules "stdlib"...).

This way, no matter how large the standard library grows, the potential for
module name conflicts doesn't grow.  It'd probably simplify things slightly,
too -- the site-packages directory could go away entirely, and all packages,
standard or not, would be on an equal footing.  The standard library would
be no more special than, say, Zope.  My /usr/lib/python would just contain



The backwards compatibility problems probably means this isn't feasible
until Python 3.0, though :(


More information about the Python-Dev mailing list