bpo-34123: Fix missed documentation update for dict.popitem(). (GH-8292) (GH#8307)

This commit is contained in:
Miss Islington (bot) 2018-07-16 19:08:13 -07:00 committed by Raymond Hettinger
parent 43c2fabb2f
commit bfa8a358e2
1 changed files with 7 additions and 1 deletions

View File

@ -4201,12 +4201,18 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
.. method:: popitem() .. method:: popitem()
Remove and return an arbitrary ``(key, value)`` pair from the dictionary. Remove and return a ``(key, value)`` pair from the dictionary.
Pairs are returned in :abbr:`LIFO (last-in, first-out)` order.
:meth:`popitem` is useful to destructively iterate over a dictionary, as :meth:`popitem` is useful to destructively iterate over a dictionary, as
often used in set algorithms. If the dictionary is empty, calling often used in set algorithms. If the dictionary is empty, calling
:meth:`popitem` raises a :exc:`KeyError`. :meth:`popitem` raises a :exc:`KeyError`.
.. versionchanged:: 3.7
LIFO order is now guaranteed. In prior versions, :meth:`popitem` would
return an arbitrary key/value pair.
.. method:: setdefault(key[, default]) .. method:: setdefault(key[, default])
If *key* is in the dictionary, return its value. If not, insert *key* If *key* is in the dictionary, return its value. If not, insert *key*