[Python-Dev] zipfile.py

M.-A. Lemburg mal@lemburg.com
Mon, 20 Dec 1999 15:44:42 +0100


"James C. Ahlstrom" wrote:
> 
> "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.

I guess it would be ok to waste space. You could provide
a .cleanup() or .rewrite() method that takes care of
reorganizing the file to fill up the gaps.
 
> > 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?

Well the module seems to work just fine with compression
on, so disallowing it or issuing a warning would reduce its value,
IMHO. How about making compression a boolean value and then
converting any true value to 8 ?

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                    11 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/