Skip to content

Commit 01b7d58

Browse files
authored
bpo-34123: Fix missed documentation update for dict.popitem(). (GH-8292)
1 parent c9265c1 commit 01b7d58

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
@@ -4220,12 +4220,18 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
42204220

42214221
.. method:: popitem()
42224222

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

42254226
:meth:`popitem` is useful to destructively iterate over a dictionary, as
42264227
often used in set algorithms. If the dictionary is empty, calling
42274228
:meth:`popitem` raises a :exc:`KeyError`.
42284229

4230+
.. versionchanged:: 3.7
4231+
4232+
LIFO order is now guaranteed. In prior versions, :meth:`popitem` would
4233+
return an arbitrary key/value pair.
4234+
42294235
.. method:: setdefault(key[, default])
42304236

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

0 commit comments

Comments
 (0)