[Python-Dev] Towards a Python based import scheme

Gordon McMillan gmcm@hypernet.com
Thu, 16 Sep 1999 13:38:03 -0400

Jim Ahlstrom wrote:

> As a result of all this import discussion I am a bit worried that
> the python library *.pyl file format may not be powerful enough.
> I have always thought in terms of unique top-level names and a
> format which supports import of modules and packages.  But this
> does not support the full functionality of PYTHONPATH.  For
> example, PYTHONPATH can (and is) used to select the correct
> plat-* directory files.  And the format may not support Jim
> Fulton's fancy local import scheme.  And what if someone invents
> a third thing to import besides a module or a package? 
> PYTHONPATH is not going away nor should it.

The central idea of imputil is that an importer is responsible for 
one little chunk of turf. If the desired module / package isn't 
"his", he just passes the request on to the next element in the 

So I don't think there's a need for one canonical do-everything 
importer (or archive format). PYTHONPATH is outside any 
particular importer. Effectively, you can use a chain of 
importers to replace PYTHONPATH. So the platform specific 
modules might be found by one particular importer. In other 
words, I think it's more effective to specialize individual 
importers and chain them up than it is to try to create an 
overly-generalized importer.

- Gordon