[Python-Dev] Relative import
barry at python.org
Wed Dec 17 21:33:43 EST 2003
On Tue, 2003-12-16 at 13:26, Guido van Rossum 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. In
> 2.5 we can start warning about relative import without a leading dot
> (although that will undoubtedly get complaints from folks who have
> code that needs to work with 2.3 still). In 3.0 we can retire
> ambiguous import.
I'll just note that where the current status quo trips /me/ up most is
when I accidentally have a local module with the same name as a global
module, and then I write an import statement expecting to get the
standard library module, but end up getting the local module.
That's why when I tend to think about this, I start wanting a way to
spell "definitely give me the global one, no matter what". IOW, I feel
like I want a way to bypass relative module lookups.
I'm still catching up on this thread, but I wanted to throw this out
More information about the Python-Dev