[Python-Dev] Re: PEP 328 - Relative Imports

Jim Fulton jim at zope.com
Fri Sep 10 13:46:58 CEST 2004

M.-A. Lemburg wrote:
> Guido van Rossum wrote:


>> As long as it's clear that this is a compatibility requirement only I
>> think it's a good idea to support this way of developing apps (even
>> though I think that clever sys.path manipulation can probably get
>> around it, it's not worth breaking existing approaches). All new apps
>> should however use relative imports to reference their own code, so
>> the problem won't be repeated in the future.
> I have my doubts that this is going to happen.
> People are more likely going to make all imports absolute (like
> they already do in Java and other languages) - which
> is good, since it makes reading code much easier and allows for
> writing packages which are compatible to older Python version,
> but it also prevent developing applications using the above
> approach.
> I also don't think that extension writers will care enough to
> make their packages fully relocateable by using relative
> imports all over - these are hard to read and don't buy
> the developer of the extension anything.

I find explicit relative imports easier to read, as it
reduces the noise level.

I like the fact that local imports look different from non-local ones.


Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org

More information about the Python-Dev mailing list