[Python-Dev] Re: Christmas Wishlist

Barry Warsaw barry at python.org
Mon Dec 15 15:23:15 EST 2003


On Mon, 2003-12-15 at 14:34, Ken Manheimer wrote:

> Currently, we can just plop the things in place, and use them.
> Without relative imports, we would have to be editing the imports in
> the packages in each place we use it.

I've heard this before, but I still don't get it, so I'd like to tease
this one out more.  What does "plop the things in place" mean?

Zope 2 has a few standard directories it adds to its PYTHONPATH.  If I
distribute a 3rd party package Zope wants to use, and that package uses
absolute imports, you can just drop the package in one of those
directories and it'll just work.

Maybe you mean that you want to drop the mythical 3rd party package in
somewhere other than a directory on Zope's PYTHONPATH and have it just
work.  I'd say that's too perverse of a use-case for Python to worry
about.

One problem with banning relative imports is that Python doesn't allow a
top-level package name to live in more than one place on PYTHONPATH.  It
would be useful for Python to support such things out of the box, say if
we wanted to adopt a Java style naming convention for package
organizations.  

Jim uses the term "pure container package" to describe top-level
packages that contain no real content in the package except
subpackages.  "zope" and "zodb" are examples of this in Zope 3.  IWBNI
Python had better/easier support for weaving together pure container
package contents where subdirectories live in different locations on the
file system.

-Barry





More information about the Python-Dev mailing list