Inconsistencies between zipfile and tarfile APIs

rantingrick rantingrick at gmail.com
Fri Jul 22 00:48:37 EDT 2011


On Jul 21, 11:13 pm, Corey Richardson <kb1... at aim.com> wrote:
> Excerpts from rantingrick's message of Thu Jul 21 23:46:05 -0400 2011:
>
> > I may have found the mother of all inconsitency warts when comparing
> > the zipfile and tarfile modules. Not only are the API's different, but
> > the entry and exits are differnet AND zipfile/tarfile do not behave
> > like proper file objects should.
>
> I agree, actually.

Unfortunately i know what the "powers that be" are going to say about
fixing this wart.

PTB: "Sorry we cannot break backwards compatibility"
Rick: But what about Python 3000?
PTB: " Oh, well, umm, lets see. Well that was then and this is now!

Maybe i can offer a solution. A NEW module called "archive.py" (could
even be a package!) which exports both the zip and tar file classes.
However, unlike the current situation this archive module will be
consistent with it's API.

>>> from archive import ZipFile, TarFile
>>> zf = ZipFile(path, *args)
>>> tf = TarFile(path, *args)



More information about the Python-list mailing list