Skip to content

Use keyword-only arguments #9412

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

Merged
merged 1 commit into from
Feb 18, 2021
Merged

Use keyword-only arguments #9412

merged 1 commit into from
Feb 18, 2021

Conversation

jdufresne
Copy link
Contributor

https://www.python.org/dev/peps/pep-3102/

Replaces the pattern: self.name = kwargs.pop('name')

Keyword-only arguments offer some advantages:

  • In the event of a typo or misuse, a more informative error is presented to the programmer.
  • More self documenting and makes interfaces more explicit.
  • They more easily allow explicit typing.

Adding types to ConfigOptionParser required changing some call sites to pass arguments without using a dict due to mypy bug:
python/mypy#9676

@sbidoul sbidoul added the skip news Does not need a NEWS file entry (eg: trivial changes) label Jan 1, 2021
https://www.python.org/dev/peps/pep-3102/

Replaces the pattern: self.name = kwargs.pop('name')

Keyword-only arguments offer some advantages:

- In the event of a typo or misuse, a more informative error is
  presented to the programmer.

- More self documenting and makes interfaces more explicit.

- They more easily allow explicit typing.

Adding types to ConfigOptionParser required changing some call sites to
pass arguments without using a dict due to mypy bug:
python/mypy#9676
@uranusjr uranusjr merged commit 4b3ecda into pypa:master Feb 18, 2021
@jdufresne jdufresne deleted the kwargs branch August 2, 2021 15:15
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
skip news Does not need a NEWS file entry (eg: trivial changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants