[Python-Dev] New and Improved Import Hooks

Fredrik Lundh fredrik@pythonware.com
Thu, 5 Dec 2002 11:40:52 +0100


mal wrote:

> > Why not leave sys.path as list of ordinary strings and add
> > all the extra support to the existing import mechanism via
> > hooks at the right places ?!

since everybody knows that sys.path is used to specify the search
path for modules, sys.path is the right place.

> Here's a sketch:
>=20
> 1. User programs register import hooks based on REs which are
>     used to match the entries in sys.path, e.g. ".*\.zip" for
>     ZIP importers (caching could help in improving the mapping
>     performance).

a solution that won't let you wrap up the standard library isn't much
of a solution (portions of both RE engines are written in Python)

I think this is overkill.  let's keep it simple and grokable.

</F>