GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-131885: Document that dict.setdefault takes no keyword arguments by adamtheturtle · Pull Request #128208 · python/cpython

Conversation

@adamtheturtle

@adamtheturtle adamtheturtle commented Dec 23, 2024 •
edited by picnixz
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Running

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

gives:

TypeError: dict.setdefault() takes no keyword arguments
  • Issue: Update function signatures to use * and / as needed #131885

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@adamtheturtle
Document that dict.setdefault takes no keyword arguments
9cac0ec
Running

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

gives:

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

adamtheturtle commented Dec 24, 2024

Copy link
Copy Markdown
Contributor Author

Related: #128207

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz picnixz added the skip issue label Dec 24, 2024
@ZeroIntensity ZeroIntensity added needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes labels Mar 25, 2025
ZeroIntensity
ZeroIntensity reviewed Mar 25, 2025
View reviewed changes

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@adamtheturtle
Add positional-only indicator to get method.
6730fe8
@adamtheturtle

adamtheturtle commented Mar 25, 2025

Copy link
Copy Markdown
Contributor Author

Could you document this for get as well?

@ZeroIntensity I have now done that

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ZeroIntensity
Merge branch 'main' into patch-2
beceaae
ZeroIntensity
ZeroIntensity approved these changes Mar 25, 2025
View reviewed changes

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Mar 25, 2025
@ZeroIntensity ZeroIntensity mentioned this pull request Mar 25, 2025
Document that dict.get takes no keyword arguments #128207
Closed
@ZeroIntensity
ZeroIntensity requested a review from picnixz March 25, 2025 15:28
@picnixz 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
picnixz approved these changes Mar 30, 2025
View reviewed changes

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Mar 30, 2025
@picnixz
Merge branch 'main' into patch-2
4b2c4de
@picnixz picnixz mentioned this pull request Mar 30, 2025
Update function signatures to use * and / as needed #131885
Open
4 of 5 tasks
@picnixz
picnixz enabled auto-merge (squash) March 30, 2025 09:18
@picnixz picnixz removed the skip issue label Mar 30, 2025
@picnixz
picnixz merged commit edfbd8c into python:main Mar 30, 2025
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Mar 30, 2025
@miss-islington-app

miss-islington-app Bot commented 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.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Mar 30, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 30, 2025
@adamtheturtle @miss-islington
pythongh-131885: Document that dict.setdefault and dict.get take …
b5d3303
…no keyword arguments (pythonGH-128208)

(cherry picked from commit edfbd8c)

Co-authored-by: Adam Dangoor <[email protected]>
@bedevere-app

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Mar 30, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 30, 2025
@adamtheturtle @miss-islington
pythongh-131885: Document that dict.setdefault and dict.get take …
000b076
…no keyword arguments (pythonGH-128208)

(cherry picked from commit edfbd8c)

Co-authored-by: Adam Dangoor <[email protected]>
@bedevere-app

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

picnixz commented Mar 30, 2025

Copy link
Copy Markdown
Member

Thank you for the fix!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

picnixz pushed a commit that referenced this pull request Mar 30, 2025
@miss-islington @adamtheturtle
[3.13] gh-131885: Document that dict.setdefault and dict.get take…
2570896
… 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 <[email protected]>
picnixz pushed a commit that referenced this pull request Mar 30, 2025
@miss-islington @adamtheturtle
[3.12] gh-131885: Document that dict.setdefault and dict.get take…
525eddf
… 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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz approved these changes
@ZeroIntensity ZeroIntensity ZeroIntensity approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@adamtheturtle @picnixz @ZeroIntensity
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.