[Python-Dev] Relative Package Imports

Greg Stein gstein@lyra.org
Thu, 16 Sep 1999 04:57:20 -0700


Guido van Rossum wrote:
>...
> What breakage?  I think __ is a bit too hard to fix easily with a
> smart editor.  And believe me, at some point *someone* is going to
> need to rip out your custom importer because it interferes with *his*
> custom importer, and he'll choose to replace all your __ imports with
> absolute package names, rather than trying to add the __ feature to
> his importer.

This is an aspect of Python's singular import hook. imputil is designed
to allow for multiple Importers to be present and to work in harmony. As
long as each Importer can identify that a particular import is part of
its namespace (e.g. HTTPImporter recognizes _http_... as one of its
own), then no conflicts will arise and everything will be hunky-dory.

btw, it might be nice to allow a string to the import statement. I'd
much rather say: import "http://www.lyra.org/greg/python/qp_xml.py"

Cheers,
-g

--
Greg Stein, http://www.lyra.org/