Armin Rigo added the comment:

Modifying an ordered dict while iterating over it can be officially classified 
as an ok think to do, but then the precise behavior must described in the 
documentation in some details, with of course matching implementation(s) and 
tests.  I mean by that that the behavior should not be "it might miss some 
elements", but rather something precise like: consider the ordered dict as 
simply a list of its elements, and consider __delitem__ as replacing an element 
with NULL.  Then forward or backward iteration works like forward or backward 
iteration over this list, with the additional rule that NULL elements are 
skipped over.

It would imho be a good possible solution, but it obviously requires more 
effort.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19414>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to