"James C. Ahlstrom" wrote:
"M.-A. Lemburg" wrote:
- Why are .py files being outlawed ?
My reason was that if *.py[co] are missing or out of date, zip importing will be slow and users won't figure out what is wrong. Generally I favor user-proof features over expert features. I prefer things which either "Just Work" or fail spectacularly. But I am open to changing this.
If you don't include the *.py file in the archive, chances are high that tracebacks will no longer print out as they do today (another problem here is that the filename being used in the code object will probably not be found... not sure whether we can fix this one).
By only looking at the .pyc or .pyo you'll also introduce a Python version problem into the ZIP-archive: the magic in these files changs rather frequently and e.g. a more recent release of Python won't be able to load these from a ZIP-archive which only contains .pycs from a compile by a less recent version.
- Where's the C implementation you mention in the PEP ?
Software is like pancakes, you should always throw the first one away. I will post it if you want, but it is not done.
That's true :-) Still, I'd like a chance to at least look at the impact this has on import.c and of course play with it so that I can test it in everyday situations.
- Would it be possible to ship zlib together with Python ? (the zlib license should allow this and I don't think that the code size is too big)
OK by me. But uncompressed zip archives work, and may even be faster than conpressed archives.
Even if uncompressed archive would work faster, the compiled libz is only 70k on Linux and I think we could solve a great number of (zlib version) problems by including zlib in Python. It's one of those basic tools you need frequently, but is even more frequently not configured as Python module :-(
Since it is already included in the Windows builds, I guess adding it to core for Unix and Macs too wouldn't hurt all that much.
It would also save you the trouble of maintaining the code for scanning uncompressed zip-archives in your ZIP import code, so we win on two counts :-)