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

Andrew Barnert abarnert at yahoo.com
Fri May 10 21:38:47 CEST 2013


On May 10, 2013, at 10:42, Serhiy Storchaka <storchaka at gmail.com> wrote:

> 10.05.13 20:30, Daniel Holth написав(ла):
>> I wrote it because the last file in a particular zip archive is an
>> embedded digital signature. To re-sign the file you may remove the
>> file, add or remove signatures from that file, and append the new
>> signatures file.
> 
> Well. There is no need to include this specialized feature in the stdlib. Just use it in your project. Instead of touching private _didModify attribute, set `self.comment = self.comment`.

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.

Either way, you'll want a comment explaining why this works (and which versions of the stdlib it's been verified to work with) if you're doing this from outside.


More information about the Python-ideas mailing list