[Distutils] formencode as .egg in Debian ??

Ian Bicking ianb at colorstudy.com
Tue Nov 22 17:19:12 CET 2005

Phillip J. Eby wrote:
>>Note also that in many cases, the package will be a single .egg file,
>>(analagous to a Java .jar file) rather than a directory, and files are
>>preferable to directories in most cases as they make Python import
>>processing faster.
> Yes, it's true, zipfile import processing is faster than normal import 
> processing; it is in fact one of the reasons zipfile imports were added to 
> Python, because the zip directories are cached.  A zipfile import lookup is 
> a single dictionary lookup, whereas a directory import lookup requires 
> multiple stat() calls.  For all practical purposes, zipfiles added to 
> sys.path are free after the initial directory read operation.

Maybe an easier way to understand this (at least my impression) is that 
zip files are treated as read-only.  Any directory on sys.path gets 
scanned everytime a new module is imported.  And you never know if 
someone added something, so you do it all over again each time.  A zip 
file is scanned only once.

Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org

More information about the Distutils-SIG mailing list