[Python-Dev] Import redesign (was: Python 1.6 status)

M.-A. Lemburg mal@lemburg.com
Fri, 19 Nov 1999 10:22:48 +0100


Guido van Rossum wrote:
>
> Let's first complete the requirements gathering.  Are these
> requirements reasonable?  Will they make an implementation too
> complex?  Am I missing anything?

Since you were asking: I would like functionality equivalent
to my latest import patch for a slightly different lookup scheme
for module import inside packages to become a core feature.

If it becomes a core feature I promise to never again start
threads about relative imports :-)

Here's the summary again:
"""
[The patch] changes the default import mechanism to work like this:

>>> import d # from directory a/b/c/
try a.b.c.d
try a.b.d
try a.d
try d
fail

instead of just doing the current two-level lookup:

>>> import d # from directory a/b/c/
try a.b.c.d
try d
fail

As a result, relative imports referring to higher level packages
work out of the box without any ugly underscores in the import name.
Plus the whole scheme is pretty simple to explain and straightforward.
"""

You can find the patch attached to the message "Walking up the package
hierarchy" in the python-dev mailing list archive.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                    42 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/