PyDocs

Nav

Python Runtime Services

KW_ONLY

dataclasses

data · Added in 3.10
A sentinel object used as a type annotation. Any fields after a pseudo-field with the type of KW_ONLY are marked as keyword-only fields. Note that a pseudo-field of type KW_ONLY is otherwise completely ignored. This includes the name of such a field. By convention, a name of _ is used for a KW_ONLY field. Keyword-only fields signify __init__() parameters that must be specified as keywords when the class is instantiated.
Changed in 3.15
  • 3.15: KW_ONLY is now a sentinel object.
0 Examples
No examples for dataclasses/KW_ONLY.
See Also
No see-alsos for dataclasses/KW_ONLY
0 Notes
No notes for KW_ONLY