diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2018-07-17 00:20:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-17 00:20:15 (GMT) |
commit | 01b7d5898262dbe0e9edb321b3be9a34da196f6f (patch) | |
tree | e35d7c5cec622733dfbf3ceb2b91fcab3ace8370 | |
parent | c9265c1534b7e62bb9b15460d0420c0c3bb57ff9 (diff) | |
download | cpython-01b7d5898262dbe0e9edb321b3be9a34da196f6f.zip cpython-01b7d5898262dbe0e9edb321b3be9a34da196f6f.tar.gz cpython-01b7d5898262dbe0e9edb321b3be9a34da196f6f.tar.bz2 |
bpo-34123: Fix missed documentation update for dict.popitem(). (GH-8292)
-rw-r--r-- | Doc/library/stdtypes.rst | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index c9e3a94..66467ac 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4220,12 +4220,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* |