[Python-Dev] Zipfile and tarfile
Itamar Shtull-Trauring
twisted@itamarst.org
Sun, 14 Apr 2002 18:13:14 +0300
Gustavo Niemeyer wrote:
> I'd rather choose a default interface similar where possible to that
> of zipfile. This makes it easy to include support to tar.gz in programs
> already supporting zipfile, and also creates some standardization. I'm
> including python-dev in the discussion to know what they think about
> this
Well, there's a problem with this - zipfile currently gives no way for users
to access a file in the zip, except as a string. So, if you've got a 20MB
file in your ZIP, and you want to read it in Python, you end up with a 20MB
string object. I therefore think that as far as reading ZIP files, Python is
very very broken, so limiting tarfile to that API isn't a great idea.
I submitted a patch that solved this, which was rejected since I didn't
write enough test code or documentation:
https://sourceforge.net/tracker/index.php?func=detail&aid=424856&group_id=5470&atid=305470
So, tarfile should use this updated API for compatability - one day I'll
find the time to write those tests and docs. Meanwhile a version of
zipfile.py with this feature can be found at
http://itamarst.org/software/zipfile.py