Roundup Robot added the comment:
New changeset 5fd1f8271e8a by Serhiy Storchaka in branch '3.4':
Issue #20729: Restored the use of lazy iterkeys()/itervalues()/iteritems()
http://hg.python.org/cpython/rev/5fd1f8271e8a
New changeset acb30ed7eceb by Serhiy Storchaka in branch 'default':
Issue
Changes by Serhiy Storchaka storch...@gmail.com:
--
resolution: - fixed
stage: patch review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20729
___
Serhiy Storchaka added the comment:
If there are no objections I'll commit this patch.
--
assignee: - serhiy.storchaka
versions: +Python 3.5 -Python 3.3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20729
R. David Murray added the comment:
Committing the patch seems like the right thing to do at this point in time.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20729
___
New submission from Chris Angelico:
Only noticed because I was searching the stdlib for hasattr calls, but in
mailbox.Mailbox.update(), a check is done thus:
if hasattr(arg, 'iteritems'):
source = arg.items()
elif hasattr(arg, 'items'):
source =
Serhiy Storchaka added the comment:
Actually it should be iteritems(). This is meant to support Mailbox, which has
both iteritems() and items() methods. iteritems() returns an iterator and
items() returns a list. Looks as changeset f340cb045bf9 was incorrectly applied
to mailbox. Here is a
Terry J. Reedy added the comment:
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
Peter Otten added the comment:
Do you expect many use cases that rely on items(), keys(), and values() being
lists?
Maybe it would be acceptable to make these lazy in 3.5, but keep the iterXXX()
variants as aliases indefinitely.
--
nosy: +peter.otten
Serhiy Storchaka added the comment:
Note that there is a difference between Mailbox and dict interface: __iter__()
iterates over values, not keys.
clear() should use keys(), not iterkeys(), because it modifies iterated dict.
--
___
Python tracker