-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-131885: Document that dict.setdefault takes no keyword arguments #128208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Running ```python {}.setdefault("a", default=1) ``` gives: ``` TypeError: dict.setdefault() takes no keyword arguments ```
Related: #128207 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay on the review. Could you document this for get
as well?
@ZeroIntensity I have now done that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could argue that this would violate the Mapping contract and that we have a "bug". Yes it violates the contract, however, the EB has decided that this should be the guidelines (see also #129669 (comment)), so this specific change should not be blocked.
Thanks @adamtheturtle for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…no keyword arguments (pythonGH-128208) (cherry picked from commit edfbd8c) Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
GH-131893 is a backport of this pull request to the 3.13 branch. |
…no keyword arguments (pythonGH-128208) (cherry picked from commit edfbd8c) Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
GH-131894 is a backport of this pull request to the 3.12 branch. |
Thank you for the fix! |
…no keyword arguments (python#128208)
Running
gives:
*
and/
as needed #131885📚 Documentation preview 📚: https://cpython-previews--128208.org.readthedocs.build/en/128208/library/stdtypes.html#dict.setdefault