[Python-Dev] New and Improved Import Hooks

Moore, Paul Paul.Moore@atosorigin.com
Thu, 5 Dec 2002 09:21:29 -0000


From: Guido van Rossum [mailto:guido@python.org]
> I still think I'd like sys.path to be a real list of real strings
> (not necessarily representing files or directories though), with
> a configurable set of handlers that are given a chance to deal
> with each string in turn.

That's exactly what I am arguing for.

Jim Ahlstrom's existing patch makes this happen, for the extremely
specific case of zip files only.

Gordon McMillan's iu.py code offers this in a general way, but in
Python - and hence with a (fairly small!) efficiency hit, and no
obvious way of writing hooks in C.

I believe that taking Gordon's design and implementing it in C,
along with a standardised zip import hook, satisfies both Just's
requirements and the requirements of PEP 273. But if it's not
possible to do this in the available timescale, we should just go
with Jim's patch for now (and maybe add iu.py to the standard
library, as an interim pure-python solution), and look at import
hooks in the longer term. I see no obvious value in going through
the design process again, from scratch.

Paul.