Skip to content
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

dict.fromkeys must mark its parameters as pos-only #121196

Closed
sobolevn opened this issue Jul 1, 2024 · 0 comments
Closed

dict.fromkeys must mark its parameters as pos-only #121196

sobolevn opened this issue Jul 1, 2024 · 0 comments
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Jul 1, 2024

Bug report

Here's how it looks now:
Снимок экрана 2024-07-01 в 10 05 59

From this defitinion I undertand that I can pass value as a named keyword, but I can't:

>>> dict.fromkeys(x, value=0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: dict.fromkeys() takes no keyword arguments
>>> import inspect
>>> inspect.signature(dict.fromkeys)
<Signature (iterable, value=None, /)>

I just made this error in a real code: wemake-services/wemake-python-styleguide#2994

Many other definitions in this file use / to properly mark positional only parameters. Like:
Снимок экрана 2024-07-01 в 10 08 24
Снимок экрана 2024-07-01 в 10 10 42

and etc.

So, I will send a PR to add / to dict.fromkeys

Linked PRs

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error docs Documentation in the Doc dir labels Jul 1, 2024
sobolevn added a commit to sobolevn/cpython that referenced this issue Jul 1, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 1, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 1, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 1, 2024
sobolevn added a commit that referenced this issue Jul 1, 2024
) (#121243)

gh-121196: Document `dict.fromkeys` params as pos-only (GH-121197)
(cherry picked from commit 1dc9a4f)

Co-authored-by: sobolevn <[email protected]>
sobolevn added a commit that referenced this issue Jul 1, 2024
) (#121242)

gh-121196: Document `dict.fromkeys` params as pos-only (GH-121197)
(cherry picked from commit 1dc9a4f)

Co-authored-by: sobolevn <[email protected]>
Akasurde pushed a commit to Akasurde/cpython that referenced this issue Jul 3, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
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 type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants