Inconsistencies between zipfile and tarfile APIs

Ryan Kelly ryan at
Fri Jul 22 01:56:22 EDT 2011

On Fri, 2011-07-22 at 01:45 -0400, Terry Reedy wrote:
> On 7/22/2011 12:48 AM, rantingrick wrote:
> > On Jul 21, 11:13 pm, Corey Richardson<kb1... at>  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.
> Hmm. Archives are more like directories than files. Windows, at least, 
> seems to partly treat zipfiles as more or less as such. Certainly, 7zip 
> present a directory interface. So opening a zipfile/tarfile would be 
> like opening a directory, which we normally do not do. On the other 
> hand, I am not sure I like python's interface to directories that much.

Indeed.  Actually, I'd say that archives are more like *entire
filesystems* than either files or directories.

We have a pretty nice ZipFS implementation as part of the PyFilesystem

If anyone cares enough to whip up a TarFS implementation it would be
gratefully merged into trunk.  (There may even be the start of one in
the bugtracker somewhere, I don't recall...)



Ryan Kelly  |  This message is digitally signed. Please visit
ryan at        | for details

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the Python-list mailing list