[Python-Dev] Re: Relative import

Ken Manheimer klm at zope.com
Thu Dec 18 12:20:30 EST 2003

+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.)

I also like your proposal for a "no ambiguous imports" flag

  from __future__ import absolute_import

klm at zope.com

More information about the Python-Dev mailing list