Skip to content

Commit

Permalink
Document that dict.get takes no keyword arguments
Browse files Browse the repository at this point in the history
Running

```python
{}.get("a", default="b")
```

gives:

```
    {}.get("a", default="b")
    ~~~~~~^^^^^^^^^^^^^^^^^^
TypeError: dict.get() takes no keyword arguments
```
  • Loading branch information
adamtheturtle authored Dec 23, 2024
1 parent 30efede commit 3115cb1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4640,7 +4640,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
Expand Down

0 comments on commit 3115cb1

Please sign in to comment.