[Python-Dev] zipfile.py

M.-A. Lemburg mal@lemburg.com
Sat, 18 Dec 1999 14:17:52 +0100


"James C. Ahlstrom" wrote:
> 
> "M.-A. Lemburg" wrote:
> >
> > "James C. Ahlstrom" wrote:
> > > >    ftp://ftp.interet.com/pub/pylib.html
> > >
> 
> > Unfortunately, I always get the following traceback when trying
> > to print the directory:
> 
> Yes, compression isn't there yet.  I am looking into it.

Great :-)
 
> > Some notes on the API:
> > ----------------------
> > * I would find it more convenient if the filename and mode
> > would be constructor parameters, e.g.
> >
> >         zfile = zipfile('myfile.zip','rb')
> 
> OK, done.
> 
> > with compression defaulting to 8 rather than 0 (most zip files
> > will be deflated since this is the ZIP default).
> 
> Until compression works, and zlib ships with Python I
> would rather default to no compression (method 0).  Otherwise
> this is not useful as a Python import archive.

Point taken.

Perhaps it would be even better to not have a
default at all: that way people will have to think about the
issue *before* implementing it, rather than debug code
that produces tracebacks.

> > * Also, I would like a method much like the os.listdir()
> > which returns a list of filenames rather than print it
> > to stdout.
> 
> OK, done.
> 
> > * .is_zipfile() should probably be a separate function: it
> > doesn't use any of the class' features.
> 
> OK, done.

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