Skip to content

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

Closed
@sobolevn

Description

@sobolevn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions