[Python-Dev] Inconsistent behaviour in import/zipimport hooks

Phillip J. Eby pje at telecommunity.com
Wed Nov 9 20:48:25 CET 2005


At 11:32 AM 11/9/2005 -0800, Guido van Rossum wrote:
>On 11/9/05, Osvaldo Santana <osantana at gmail.com> wrote:
> > I've noticed this inconsistency when we stop to use zipimport in our
> > Python For Maemo distribution. We've decided to stop using zipimport
> > because the device (Nokia 770) uses a compressed filesystem.
>
>I won't comment further on the brainstorm that's going on (this is
>becoming a topic for c.l.py) but I think you are misunderstanding the
>point of zipimport. It's not done (usually) for the compression but
>for the index. Finding a name in the zipfile index is much more
>efficient than doing a directory search; and the zip index can be
>cached.

zipimport also helps distribution convenience - a large and elaborate 
package can be distributed in a single zipfile (such as is built by 
setuptools' "bdist_egg" command) and simply placed on PYTHONPATH or 
directly on sys.path.  And tools like py2exe can also append all an 
application's modules to an executable file in zipped form.



More information about the Python-Dev mailing list