[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

Raymond Hettinger report at bugs.python.org
Sun Jun 15 03:00:31 CEST 2014


Raymond Hettinger added the comment:

Sorry Nikolaus, I'm happy with the code and docs as they are.  In general, you should assume that unless documented otherwise, any pure python container (stdlib or 3rd party) has undefined behavior if you mutate while iterating (like you should not assume thread-safety unless a container is documented as threadsafe).  At your behest, I added extra code to trigger an earlier and more visible failure in some circumstances, but that is the limit.  OrderedDicts have been around for a good while (not just the stdlib but also in other code predating the one in the stdlib), so we know that this hasn't been a problem in practice. 

Please declare victory, move on, and don't keep extending this closed thread.

----------

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


More information about the Python-bugs-list mailing list