[Import-sig] Re: Long-awaited imputil comments
Just van Rossum
Wed, 16 Feb 2000 19:40:51 +0100
I kindof lost track here, is it ok if I take a step back?
I don't like the chaining aspect of imputil.py. I think I remember that
Greg did this mainly to remain as compatible as possible, but I don't see a
reason to keep it that way. What you end up with is a linked list, which
seems, uh, a little un-pythonic... (and a little awkward to manipulate.)
What's needed is pluggable importers. Once proposal I remember (I think it
was also Greg's) was that elements on sys.path could be importer instances.
Is this still being proposed?
I also vaguely remember someone saying that this was not optimal, since
it's a 2-dimensional problem: there's a list of directories/files to
search, and a list of importers. Would it make sense to add a new variable
to the sys module, called "importers" or something, which contains a list
of, erm, importers? And drop the __import__ hook. People would plug the
import mechanism by manipulating sys.importers instead of mucking with
__builtin__.__import__. Importers could then traverse sys.path, or use
their own list of things.