From d6ed6e8758db843afeb122d09ea89fa353ccd2bf Mon Sep 17 00:00:00 2001 From: Landon Wood <landon@elkrange.com> Date: Tue, 21 May 2024 12:43:27 -0400 Subject: [PATCH 1/3] Update default to default=None in dict .get() doc --- Doc/library/stdtypes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index f97597dc565449..563ac94abab110 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4575,7 +4575,7 @@ can be used interchangeably to index the same dictionary entry. such as an empty list. To get distinct values, use a :ref:`dict comprehension <dict>` instead. - .. method:: get(key[, default]) + .. method:: get(key[, default=None]) Return the value for *key* if *key* is in the dictionary, else *default*. If *default* is not given, it defaults to ``None``, so that this method From b0fb2d276dba730cb6f253c64ddea0d3eb40e673 Mon Sep 17 00:00:00 2001 From: Landon Wood <landon@elkrange.com> Date: Tue, 21 May 2024 13:57:45 -0400 Subject: [PATCH 2/3] Update signatures for fromkeys, get, pop, and setdefault --- Doc/library/stdtypes.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 563ac94abab110..a5fb4258857b93 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4565,7 +4565,7 @@ can be used interchangeably to index the same dictionary entry. Return a shallow copy of the dictionary. - .. classmethod:: fromkeys(iterable[, value]) + .. classmethod:: fromkeys(iterable, value=None) Create a new dictionary with keys from *iterable* and values set to *value*. @@ -4575,7 +4575,7 @@ can be used interchangeably to index the same dictionary entry. such as an empty list. To get distinct values, use a :ref:`dict comprehension <dict>` instead. - .. method:: get(key[, default=None]) + .. method:: get(key, default=None) Return the value for *key* if *key* is in the dictionary, else *default*. If *default* is not given, it defaults to ``None``, so that this method @@ -4591,7 +4591,7 @@ can be used interchangeably to index the same dictionary entry. Return a new view of the dictionary's keys. See the :ref:`documentation of view objects <dict-views>`. - .. method:: pop(key[, default]) + .. method:: pop(key, default=None) If *key* is in the dictionary, remove it and return its value, else return *default*. If *default* is not given and *key* is not in the dictionary, @@ -4617,7 +4617,7 @@ can be used interchangeably to index the same dictionary entry. .. versionadded:: 3.8 - .. method:: setdefault(key[, default]) + .. method:: setdefault(key, default=None) If *key* is in the dictionary, return its value. If not, insert *key* with a value of *default* and return *default*. *default* defaults to From 58b2163ebbf50c1f6aaaef37cbd8d1c94c68d394 Mon Sep 17 00:00:00 2001 From: Landon Wood <landon@elkrange.com> Date: Tue, 21 May 2024 16:31:48 -0400 Subject: [PATCH 3/3] Update Doc/library/stdtypes.rst Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> --- Doc/library/stdtypes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index a5fb4258857b93..c0a3d0b3a2a49e 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4591,7 +4591,7 @@ can be used interchangeably to index the same dictionary entry. Return a new view of the dictionary's keys. See the :ref:`documentation of view objects <dict-views>`. - .. method:: pop(key, default=None) + .. method:: pop(key[, default]) If *key* is in the dictionary, remove it and return its value, else return *default*. If *default* is not given and *key* is not in the dictionary,