[Python-Dev] PEP 273 - inporting from zipfiles

Jack Jansen jack@oratrix.nl
Mon, 29 Oct 2001 15:07:14 +0100


Jim,
for your implementation you might want to have a look at the 
Macintosh-specific code in import.c (and possibly at related code in 
Mac/macglue.c, but that's probably less relevant).

MacPython can already have files on sys.path, and there's code to look through 
these files for PYC resources. Don't worry what they are or how it's done, but 
they contain compiled modules.

I got a pretty significant increase of import speed is when I added a cache of 
which sys.path entries were files and which were directories, so for each 
sys.path entry you know that you can skip one leg of the find_module() code. 
This is all in import.c, so you could probably enable it verbatim for zipfile 
imports.

--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.cwi.nl/~jack        | ++++ see http://www.xs4all.nl/~tank/ ++++