[Python-Dev] Re: Relative import

Guido van Rossum guido at python.org
Thu Dec 18 12:50:41 EST 2003

[Ken Manheimer]
> +1 for the '.' proposal, where (to verify my understanding):
>   - '.' indicates "import from the current package", '..' means "import
>     from the package of my package", and so forth,
>   - imports where the package part lacks a leading '.' are absolute, ie
>     from the top level of the path.
> -1 for the '...' proposal, where '...' means a search from the current
>    package up to the most superior containing package (which is
>    actually a virtual package that entails the entire path).
> Ie, i am for absolute being the default and explicit-relative being
> available, and against ambiguous relative aka scanning the hierarchy.
> (I might be convinced otherwise about the scanning deal, but i think
> the more deterministic we can make imports, while still keeping them
> flexible enough to do what people need, the better.)

Thanks!  Your vote is especially important for me because as far as I
can remember you proposed the scan-up rule for the very first version
of "ni" that we developed together back in 1995!

> I also like your proposal for a "no ambiguous imports" flag
>   from __future__ import absolute_import

OK.  Wanna write a PEP?  Just kidding, I know you have less time than
I do for it.  So... *anybody* wanna write a PEP about this?  (The
parentheses proposal should also be folded in.)

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list