[Python-Dev] PEP 328 - Relative Imports

M.-A. Lemburg mal at egenix.com
Wed Sep 8 16:47:35 CEST 2004


Hi there,

I know that this has been discussed a few times in the past,
but the more I have to deal with building applications using
third-party libs or packages, the more I get the feeling that
the choice of making "import module" absolute is the wrong
path to follow.

The typical scenario goes like this:

* you build an application that uses various third-party
   packages and has to maintain them inside another package,
   e.g. ThirdPartyCode

* you don't have access to the (third-party) package source code or
   it's not feasable to make changes to it for maintenance reasons

Another common case is that you have to deal with third-party
code that is not properly packaged as Python package, but comes
as a set of top-level modules.

In this scenario you typically put all those files into a
newly created Python package directory and access the modules
in that directory using the package name.

In Python 2.3 and 2.4 (as well as all previous versions), both
scenarios can easily be implemented without having to change
the third-party code.

The PEP however suggests that starting with 2.5, the interpreter
will issue a warning and 2.6 should default to absolute paths.

I'd like to request that the latter change be postponed to
Python 3k, or that some other way of supporting the above
scenarios is provided that can be enabled in the application.

Please remember that changes to application code are well
possible. What's not possible is making changes to the
packaged third-party code.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Sep 08 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the Python-Dev mailing list