[Python-Dev] zipfile.py

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


Fredrik Lundh wrote:
> 
> James C. Ahlstrom wrote:
> > >
> > >    ftp://ftp.interet.com/pub/pylib.html

> -- it would be great if "open" could take an open file
> object as well as a file name.

I put these arguments into the constructor now.

> (in this case, you also need to document what you
> expect from the underlying file object: read, write,
> seek, tell should be enough, right?  haven't looked
> at the code -- assuming it works, I'm only interested
> in the interface)

OK, docs updated.

> -- I assume "open" adds "b" to the given mode argument.

Correct.  The mode can be either "w" or "wb" etc., and it works.

> -- "dir" looks a bit strange.  and hey, there's no "listdir"
> in there.  I'd prefer a recursive "listdir" method, which
> takes an optional "depth" argument (e.g. 0=this dir,
> 1=this dir and first subdir, None=infinity, i.e. the full
> tree).

I added a plain listdir() and changed dir() to printdir().  I also
documented self.TOC which gets you the values too.

JimA