[docs] [issue34123] ambiguous documentation for dict.popitem

Raymond Hettinger report at bugs.python.org
Mon Jul 16 03:57:49 EDT 2018


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> Is there no possible optimizations by breaking LIFO dict.popitem()?

Even if there were a possible optimization, we wouldn't care.  The API is too desirable to forgo in the name of micro-optimization.  We don't design our APIs that way -- trading the relevant and actionable for ethereal and unknown.

Also, it is common sense that addition of a key/value pair at the end is a readily undoable operation (no more expensive to remove than it was to add). There will be a dummy entry in the hash array just like there is now.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34123>
_______________________________________


More information about the docs mailing list