Skip to content

Commit 9801fba

Browse files
[3.12] gh-110383: Align dict.get(), .fromkeys(), and .setdefault() docs with docstrings (GH-119330) (#119371)
(cherry picked from commit 0e3c8cd) Co-authored-by: Landon Wood <[email protected]>
1 parent 47b09d2 commit 9801fba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/library/stdtypes.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -4556,7 +4556,7 @@ can be used interchangeably to index the same dictionary entry.
45564556

45574557
Return a shallow copy of the dictionary.
45584558

4559-
.. classmethod:: fromkeys(iterable[, value])
4559+
.. classmethod:: fromkeys(iterable, value=None)
45604560

45614561
Create a new dictionary with keys from *iterable* and values set to *value*.
45624562

@@ -4566,7 +4566,7 @@ can be used interchangeably to index the same dictionary entry.
45664566
such as an empty list. To get distinct values, use a :ref:`dict
45674567
comprehension <dict>` instead.
45684568

4569-
.. method:: get(key[, default])
4569+
.. method:: get(key, default=None)
45704570

45714571
Return the value for *key* if *key* is in the dictionary, else *default*.
45724572
If *default* is not given, it defaults to ``None``, so that this method
@@ -4608,7 +4608,7 @@ can be used interchangeably to index the same dictionary entry.
46084608

46094609
.. versionadded:: 3.8
46104610

4611-
.. method:: setdefault(key[, default])
4611+
.. method:: setdefault(key, default=None)
46124612

46134613
If *key* is in the dictionary, return its value. If not, insert *key*
46144614
with a value of *default* and return *default*. *default* defaults to

0 commit comments

Comments
 (0)