From 9cac0ec7b583222a278cb7de0e1ce21c116a1001 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Mon, 23 Dec 2024 23:41:49 +0000 Subject: [PATCH] Document that dict.setdefault takes no keyword arguments Running ```python {}.setdefault("a", default=1) ``` gives: ``` TypeError: dict.setdefault() takes no keyword arguments ``` --- 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 191827526e890f..dd0ee59df3039d 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4682,7 +4682,7 @@ can be used interchangeably to index the same dictionary entry. .. versionadded:: 3.8 - .. method:: setdefault(key, default=None) + .. 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