[Python-Dev] PEP 328: import...as with relative import (original) (raw)

Bob Ippolito bob at redivi.com
Sun May 9 21:17:53 EDT 2004


On May 9, 2004, at 9:03 PM, Greg Ewing wrote:

Nick Coghlan <ncoghlan at iinet.net.au>:

The other point in favour of the current way is that a bare import statement is always absolute, which further encourages absolute imports as the standard approach. I don't understand why absolute imports should be regarded as the "standard approach". Absolute imports are appropriate for some things, relative imports are appropriate for other things. You can't say that one is "standard" and the other isn't.

Either way, right now it's a real pain when you have a relative and absolute module with the same name. You simply can't import the absolute one by standard means. It would be at least nice if you could explicitly state that some import should be absolute (given the current relative-first search order). I generally use absolute imports everywhere, because I've found it generally avoids problem -- but it certainly wasn't my first instinct when learning Python.

-bob



More information about the Python-Dev mailing list