[Python-Dev] Draft: PEP for imports

Phillip J. Eby pje at telecommunity.com
Fri Jan 30 18:54:19 EST 2004


At 11:40 PM 1/30/04 +0000, Armin Rigo wrote:

>A more radical point of view is that these sys.path hacks are here not because
>of a missing feature, but on the contrary to work around the way Python tries
>to isolate me from the "messiness out there" (the file system) by mapping it
>into a neat language construct (packages).

Without that, various kinds of "hacks" such as importing from DLLs/.so's, 
zipfiles, frozen modules, py2exe, PYTHONPATH, and the like, would not be 
practical.  These use cases alone are enough to make me -1 on adding 
explicit paths into the module system from within code.

I'm *much* more interested in making non-module (but "read-only") files 
available through the package/module abstraction, than in breaking the 
abstraction to specify directories.  For example, in PEAK I've implemented 
both a utility function ('fileNearModule("some.module","relative/path")') 
and a URL scheme ('pkgfile:some.module/relative/path') to support this.




More information about the Python-Dev mailing list