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

Chris Angelico report at bugs.python.org
Sat Apr 12 21:12:26 CEST 2014


Chris Angelico added the comment:

I agree that current behaviour is a bit confusing; also, the implication is that deleting from the dictionary while you have an iterator may leave some hanging references around the place, which raises a red flag in my mind (maybe something else might find the stale data, too).

My inclination would be to Armin's idea of setting next to None. Seems simpler than trying too hard to patch around something that's a bad idea anyway.

----------
nosy: +Rosuav

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


More information about the Python-bugs-list mailing list