[Python-Dev] zipfiles on sys.path

Just van Rossum just@letterror.com
Thu, 26 Jul 2001 00:11:06 +0200


Jack Jansen wrote:

> > - The __path__ vrbl in a package 'foo.bar' loaded from zipfile.zip
> >   will have the value ['zipfile.zip!foo/bar'] and this same syntax can
> >   also be used when adding entries to sys.path and __path__.
> 
> __path__ is set to the package name. I'm not sure of the exact
> rationale for this (Just did the package support) but it seems to work
> fine. 

I don't know the rationale either (or at least: not anymore ;-), I just copied
the behavior of frozen packages (as in freeze.py) from import.c.
PyImport_ImportFrozenModule() contains this snippet:

    if (ispackage) {
        /* Set __path__ to the package name */
        ...


Just