[issue19414] OrderedDict.values() behavior for modified instance

Nikolaus Rath report at bugs.python.org
Sun Oct 27 04:31:52 CET 2013


Nikolaus Rath added the comment:

After thinking about this a bit more, I think this is actually a true bug in OrderedDict(), and only option (a) or be (b) really fix it.

Rationale:

I would expect that for any OrderedDict d, and any function modify_dict(d), the following assertion holds:

for key in d:
    assert key in d
    modify_dict(d)

..but this actually breaks for

def modify_dict(d):
    del d[0]
    del d[1]

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19414>
_______________________________________


More information about the Python-bugs-list mailing list