Skip to content

Commit bfa8a35

Browse files
miss-islingtonrhettinger
authored andcommitted
bpo-34123: Fix missed documentation update for dict.popitem(). (GH-8292) (GH#8307)
1 parent 43c2fab commit bfa8a35

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4201,12 +4201,18 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
42014201

42024202
.. method:: popitem()
42034203

4204-
Remove and return an arbitrary ``(key, value)`` pair from the dictionary.
4204+
Remove and return a ``(key, value)`` pair from the dictionary.
4205+
Pairs are returned in :abbr:`LIFO (last-in, first-out)` order.
42054206

42064207
:meth:`popitem` is useful to destructively iterate over a dictionary, as
42074208
often used in set algorithms. If the dictionary is empty, calling
42084209
:meth:`popitem` raises a :exc:`KeyError`.
42094210

4211+
.. versionchanged:: 3.7
4212+
4213+
LIFO order is now guaranteed. In prior versions, :meth:`popitem` would
4214+
return an arbitrary key/value pair.
4215+
42104216
.. method:: setdefault(key[, default])
42114217

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

0 commit comments

Comments
 (0)