[Python-Dev] zipimport & import hooks

Martin v. Löwis Martin v. Löwis
Fri, 6 Dec 2002 15:26:37 +0100


> Hmmm.  I haven't looked that closely at Just's proposal.  Why should
.tgz or
> http://xyz be treated any differently than .zip?

There is a magic, in import.c, which, when an import statement is
executed, looks for sys.path entries ending in .zip, and silently
replaces them with zipimport objects. No such magic is available for any
other form of sys.path entries. So while you can add a urlimport object
to sys.path, you lose the hook when you convert the object to a string,
as nobody will recreate the hook.

Regards,
Martin