FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-131885: Document that dict.setdefault takes no keyword arguments by adamtheturtle · Pull Request #128208 · python/cpython · GitHub

/ cpython Public

gh-131885: Document that dict.setdefault takes no keyword arguments - #128208

Merged
picnixz merged 4 commits into
python:mainfrom
adamtheturtle:patch-2
Mar 30, 2025
Merged

gh-131885: Document that dict.setdefault takes no keyword arguments#128208
picnixz merged 4 commits into
python:mainfrom
adamtheturtle:patch-2

Conversation

adamtheturtle commented Dec 23, 2024
edited by picnixz
Loading

Copy link
Copy Markdown
Contributor

Running

{}.setdefault("a", default=1)

gives:

TypeError: dict.setdefault() takes no keyword arguments

📚 Documentation preview 📚: https://cpython-previews--128208.org.readthedocs.build/en/128208/library/stdtypes.html#dict.setdefault

Running

```python
{}.setdefault("a", default=1)
```

gives:

```
TypeError: dict.setdefault() takes no keyword arguments
```
bedevere-app Bot added docs Documentation in the Doc dir skip news awaiting review labels Dec 23, 2024

Copy link
Copy Markdown
Contributor Author

Related: #128207

ZeroIntensity added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Mar 25, 2025

ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sorry for the delay on the review. Could you document this for get as well?

Copy link
Copy Markdown
Contributor Author

Could you document this for get as well?

@ZeroIntensity I have now done that

ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks, LGTM.

ZeroIntensity requested a review from picnixz March 25, 2025 15:28
picnixz changed the title Document that dict.setdefault takes no keyword arguments gh-131885: Document that dict.setdefault takes no keyword arguments Mar 30, 2025

picnixz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

picnixz enabled auto-merge (squash) March 30, 2025 09:18
picnixz merged commit edfbd8c into python:main Mar 30, 2025
github-project-automation Bot moved this from Todo to Done in Docs PRs Mar 30, 2025

Copy link
Copy Markdown

Thanks @adamtheturtle for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 30, 2025
…no keyword arguments (pythonGH-128208)

(cherry picked from commit edfbd8c)

Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>

bedevere-app Bot commented Mar 30, 2025

Copy link
Copy Markdown

GH-131893 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Mar 30, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 30, 2025
…no keyword arguments (pythonGH-128208)

(cherry picked from commit edfbd8c)

Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>

bedevere-app Bot commented Mar 30, 2025

Copy link
Copy Markdown

GH-131894 is a backport of this pull request to the 3.12 branch.

bedevere-app Bot removed the needs backport to 3.12 only security fixes label Mar 30, 2025

picnixz commented Mar 30, 2025

Copy link
Copy Markdown
Member

Thank you for the fix!

picnixz pushed a commit that referenced this pull request Mar 30, 2025
… no keyword arguments (GH-128208) (#131893)

gh-131885: Document that `dict.setdefault` and `dict.get` take no keyword arguments (GH-128208)
(cherry picked from commit edfbd8c)

Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
picnixz pushed a commit that referenced this pull request Mar 30, 2025
… no keyword arguments (GH-128208) (#131894)

gh-131885: Document that `dict.setdefault` and `dict.get` take no keyword arguments (GH-128208)
(cherry picked from commit edfbd8c)

Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL