[Python-ideas] Add a .pop() method to ZipFile

Andrew Barnert abarnert at yahoo.com
Sat May 11 00:23:13 CEST 2013


On May 10, 2013, at 13:47, Daniel Holth <dholth at gmail.com> wrote:

> On Fri, May 10, 2013 at 4:25 PM, Serhiy Storchaka <storchaka at gmail.com> wrote:
>> 10.05.13 22:38, Andrew Barnert написав(ла):
>> 
>>> It seems like the code is already making unwarranted assumptions about the
>>> internals of ZipFile, and taking out the access to a private attribute
>>> doesn't fix that, it just makes it less obvious.
>> 
>> 
>> Indeed. infolist() may return a copy or non-modifiable proxy, NameToInfo and
>> fp are private attributes. ZipFile may save in private attribute an offset
>> of central directory.
> 
> It would be nice to have a better low-level API to ZipFile.

That might be nice. It would also answer the people who want to do the gzip themselves (to optimize p7zip style) but use the high level part of zipfile.

> Does it
> ever do these things that it may do?

Depends. If by "it" you mean "Python" in the abstract... There's no answer to that.

If you mean CPython 2.7.0-2.7.4 or 3.3.0-3.3.1, then you can verify it pretty easily (and I suspect the OP already did).

Which means if you do this from outside, you'll want a comment explaining why it works, and which versions of Python you've verified it against.




More information about the Python-ideas mailing list