
Greg Stein wrote:
On Thu, 16 Dec 1999, James C. Ahlstrom wrote:
Did anyone look at this yet?
ftp://ftp.interet.com/pub/pylib.html
ftp://ftp.interet.com/pub/zipfile.py
Looking at it now... The writepy() as a method is questionable, I think. I think it should open the file at instantiation time. I don't see a reason to allow that to be deferred. Especially given that some of the methods fail if open() hasn't been called.
I eliminated open and added its args to the constructor.
It would be good to have symbolic names for the 0 and 8 compression constants, and to fail if 8 is passed and zlib is not available (otherwise, it doesn't fail until read/write time, and with a NameError). There should probably be a __del__ that calls close(). Oh, and a "closed" attribute that can be checked and an error raised if an operation is done after the file has been closed.
All done.
I think dir() should return the contents, rather than print them.
I added listdir() and documented self.TOC. I kept printdir() as example code.
read() and write() ought to fail if the mode is incorrect. Oh, some symbolic constants for things like "PK\005\006" would be nice.
All done. JimA