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

Support kw_only? #173

Open
guysoft opened this issue Nov 17, 2022 · 0 comments
Open

Support kw_only? #173

guysoft opened this issue Nov 17, 2022 · 0 comments

Comments

@guysoft
Copy link

guysoft commented Nov 17, 2022

New in version 3.10.
kw_only: If true (the default value is False), then all fields will be marked as keyword-only. If a field is marked as keyword-only, then the only effect is that the init() parameter generated from a keyword-only field must be specified with a keyword when init() is called. There is no effect on any other aspect of dataclasses. See the parameter glossary entry for details. Also see the KW_ONLY section.

Source: https://docs.python.org/3/library/dataclasses.html

It solves the limitation that a base class can't hold default values.

Example:
https://stackoverflow.com/questions/51575931/class-inheritance-in-python-3-7-dataclasses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant