Message211951
You have opened the door on a slight mess. The mailbox module provides a set + dict interface to on-disk mailbax files in various formats. The hg annotate and revision history commands indicate that most of 3.4 mailbox is unchanged since the trunk version was merged into py3k on 2006-5-27 in rev38453. However, on 2007-2-11 Guido changed .iterxxx to .xxx throughout the stdlib in rev40809.
The bug you note is a side-effect of this patch. It overall left mailbax in a somewhat inconsistent state as it did *not* update the mailbox dict API by removing the mailbox.iterkeys/values/items methods and replacing the .keys/values/items methods. As a result, the mailbox methods that space efficiently iterated thru self.iterkeys now iterate through self.keys == list(self.iterkeys). Example:
def clear(self):
"""Delete all messages."""
for key in self.keys(): # was self.iterkeys()
self.discard(key)
To fix this, I think we should either
1) revert the rev40809 changes to mailbox, including in the line you point to, or
2) complete the rev40809 changes by updating to a Py3 interface, and make the change you suggest.
1) is much easier, but the API looks odd to a py3-only programmer.
After writing this message, I see that Serhiy wrote a patch to do this.
2) is an api change that perhaps should have happened in 3.0. Deprecation is awkward since people should not change from, for instance, self.iterkeys to self.key, until the api change in made. |
|
Date |
User |
Action |
Args |
2014-02-22 21:01:05 | terry.reedy | set | recipients:
+ terry.reedy, barry, r.david.murray, petri.lehtinen, Rosuav, serhiy.storchaka |
2014-02-22 21:01:05 | terry.reedy | set | messageid: <1393102865.33.0.794639339099.issue20729@psf.upfronthosting.co.za> |
2014-02-22 21:01:05 | terry.reedy | link | issue20729 messages |
2014-02-22 21:01:04 | terry.reedy | create | |
|