-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
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
Metadata
Metadata
Assignees
Labels
No labels