Skip to content

Commit 9cac0ec

Browse files
Document that dict.setdefault takes no keyword arguments
Running ```python {}.setdefault("a", default=1) ``` gives: ``` TypeError: dict.setdefault() takes no keyword arguments ```
1 parent 30efede commit 9cac0ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4682,7 +4682,7 @@ can be used interchangeably to index the same dictionary entry.
46824682

46834683
.. versionadded:: 3.8
46844684

4685-
.. method:: setdefault(key, default=None)
4685+
.. method:: setdefault(key, default=None, /)
46864686

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

0 commit comments

Comments
 (0)