ericvsmith / dataclasses

Apache License 2.0
587 stars 53 forks source link

Support kw_only? #173

Open guysoft opened 2 years ago

guysoft commented 2 years ago

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