[issue6017] Dict fails to notice addition and deletion of keys during iteration

Terry J. Reedy report at bugs.python.org
Sat May 16 06:20:03 CEST 2009

Terry J. Reedy <tjreedy at udel.edu> added the comment:

The OP reported a real mismatch between doc and behavior.  If the
behavior is not changed, I think the doc should be.  Other implementors,
reading the doc, might think that they do have to write code to track
changes.  From the doc, I thought that CPython did that.

So I suggest changing reopening and changing the doc to say
"Changing the net size of the dictionary while using iteritems() will
raise a RuntimeError."  Same for iterkeys() and itervalues()[sp?]

Or remove the warning, as happened in the Py3 changeover to views, or
was that a mistake?

nosy: +tjreedy

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list