Skip to content

Commit

Permalink
bpo-34123: Fix missed documentation update for dict.popitem(). (GH-8292
Browse files Browse the repository at this point in the history
…) (GH#8307)
  • Loading branch information
miss-islington authored and rhettinger committed Jul 17, 2018
1 parent 43c2fab commit bfa8a35
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Doc/library/stdtypes.rst
Expand Up @@ -4201,12 +4201,18 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:

.. 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
often used in set algorithms. If the dictionary is empty, calling
: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])

If *key* is in the dictionary, return its value. If not, insert *key*
Expand Down

0 comments on commit bfa8a35

Please sign in to comment.