Skip to content

Support kw_only? #173

@guysoft

Description

@guysoft

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions