[issue27275] KeyError thrown by optimised collections.OrderedDict.popitem()
Serhiy Storchaka
report at bugs.python.org
Thu Oct 27 04:26:18 EDT 2016
Serhiy Storchaka added the comment:
In issue28014 __getitem__() is idempotent. Multiple calls of __getitem__() return the same result and keep the OrderedDict in the same state.
> I'd be perfectly happy with making popitem implemented in terms of pop on subclasses when pop is overridden (if pop isn't overridden though, that's effectively what popitem already does).
I like this idea.
> Note: In the expiring case, the fix is still "wrong" if someone used popitem for the intended purpose (to get and delete).
Good catch! But old implementation still looks doubtful to me.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27275>
_______________________________________
More information about the Python-bugs-list
mailing list