[Python-Dev] PEP 273 - Import from Zip Archives
James C. Ahlstrom
jim@interet.com
Thu, 28 Feb 2002 09:44:44 -0500
M.-A. Lemburg wrote:
> Sure, but for finding imputil itself you still need the C import
> mechanism. Even worse: if Python can't find imputil (for some
> reason), it would be completely broken.
The other objection raised at the time was the possible
slow down of imports.
I think the existing C module search code is basically
good, although I wouldn't mind moving module import into
a Python method. But since the C works, I have little
motivation to replace it.
> My only gripe with the existing C implementation is that
> I would like to have more hooks available. Currently, you
> have to replace the complete API in order to add new
> features -- not exactly OO :-/
My code uses os.listdir to cache directory contents, but
defers its use until the os module can be imported using
the C import code. I think a similar trick could be used
to replace imports with a new module. This would make it
easy to replace imports. But this would not
make it easy to add features unless a module were available
which implemented the current import semantics in Python.
> BTW, how is progress on the ZIP import patch doing ?
> Perhaps Jim should just check in what he has so that the code
> gets a little more code review...
The code is "done" has been in Source Forge patch 492105
for some time.
I am leaving for Panama tomorrow for 8 days, so if I
seem to disappear, that's why. I would be happy to work
hard on this after I get back, because I think it is an
important addition for Python.
JimA