[Python-Dev] zipfile.py

James C. Ahlstrom jim@interet.com
Fri, 17 Dec 1999 09:39:51 -0500


"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.
 
> 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.
 
> * 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.
  
> Aside: I found that you are using undocumented arguments to
> zlib.compressobj() ... are these extra arguments left out of
> the documentation on purpose or by simple oversight ? I couldn't
> find them in the HTML docs and neither in the docstrings.

I am following the CNRI code blindly here.  I don't have
docs either.

JimA