[Python-Dev] Re: Relative import

Werner Schiendl ws-news at gmx.at
Tue Dec 16 14:53:10 EST 2003


"Guido van Rossum" <guido at python.org> wrote

> A lot people have presented a good case for relative imports.  Nobody
> has argued to keep the status quo (where imports are ambiguous about
> whether they are meant to be absolute or relative).  So I suggest that
> in 2.4, we introduce the leading dot notation for relative import,
> while still allowing relative import without a leading dot.

I'm +1 on it, I'd only wish an additional

from __future__ import strict_import

(or whatever seems a better name)

to allow a module to indicate that every not explicitly relative import
should be absolute.

This would allow module authors to be explicit from the start and it is also
a safety net
against accidentially adding a relative module with the name of some
absolute one.

best regards

More information about the Python-Dev mailing list