GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||
GeezerVison is showing github.com — Document that dict.get takes no keyword arguments by adamtheturtle · Pull Request #128207 · python/cpython Conversation
|
| def get(self, key, default=None): |
📚 Documentation preview 📚: https://cpython-previews--128207.org.readthedocs.build/
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Running
```python
{}.get("a", default="b")
```
gives:
```
{}.get("a", default="b")
~~~~~~^^^^^^^^^^^^^^^^^^
TypeError: dict.get() takes no keyword arguments
```
Interesting. I wonder if that's worth fixing (but I also wonder if this has been brought up before). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Oh, I didn't see that there is! #124675...where I participated in the discussion 😅 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I would like for it to be fixed, and I have commented on a related issue (#124675). As for "brought up before" - I'm not sure here, but I found this comment in # Positional-only in dict, but not in MutableMapping @overload # type: ignore[override] def get(self, key: _KT, /) -> _VT | None: ... @overload and discussion around that at python/typeshed#6694. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
FWIW when you asked I pasted my issue text into ChatGPT and asked "I want to write up this bug for CPython. Has any duplicate issue been brought up before?". It found me that issue! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Instead of the change proposed here, a note like the following would better reflect the status quo:
You can pass |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
That's arguably a PyPy implementation detail :) I'm going to close this in favor of #128208, which documents this for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.