[Python-Dev] New and Improved Import Hooks (original) (raw)

Guido van Rossum guido@python.org
Thu, 05 Dec 2002 06:46:36 -0500


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.

[Paul Moore]

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.

OK, except for adding iu.py -- we already have ihooks.py and imputils.py, we don't need another one until we know what we will do long term.

--Guido van Rossum (home page: http://www.python.org/~guido/)