[Python-Dev] New and Improved Import Hooks

Just van Rossum just@letterror.com
Thu, 5 Dec 2002 14:04:13 +0100


Guido van Rossum wrote:

> > Guido van Rossum wrote:
> > 
> > > Why don't you care about the backwards incompatibilities?
> > 
> > Because it's addressed by using a str subclass.
> 
> Which strikes *me* as an ugly hack. :-(

True, but you can't have your cake and eat it, too: either we implement an
elaborate scheme of registering handlers for sys.path items, or we keep it
simple and do our best to avoid breakage.

Jim Ahlstrom & Paul Moore's patch implement an elaborate scheme which isn't
exposed to Python, and it adds a fair amount of spaghetti code to an already
messy part of Python. I'm still a -1 on it.

Allowing arbitrary objects on sys.path is simple to explain, document and
implement, solves the zip import problem and offers a clean high level import
hook scheme. How much better can it get?

Just