[Python-Dev] zipfile.py

James C. Ahlstrom jim@interet.com
Mon, 20 Dec 1999 09:35:58 -0500


"M.-A. Lemburg" wrote:

> One thing I'd suugest is to include some way to delete and
> update contents, e.g. the write() method should overwrite
> any existing entry in the archive (if it not already does --
> I haven't tested it, just read the code and it seems to raise
> an exception), plus maybe a .remove() method which deletes
> an entry.

Currently, adding a file requires the "a" append mode, while
the "w" mode re-writes the file.  Adding a duplicate file name
produces an error message.  I can change this,
but removing a file would either waste space, or else the file
contents must be copied over the old file and all the offsets
updated.  I don't like this because it is complicated, and I think
it is fast enough to just re-write the archive.  But it
could be added if people want.

> True. How about making the compression argument mandatory
> for file opened in 'wb' mode only ?

The default of zero provides a little guidance that you should
use zero.  I added a warning message if 8 is used which should
discourage people from using 8.  Or I could disallow 8.
Is that OK?

JimA