ID EN
Dataclasses

fields

Python 3.11

Returns a tuple of Field objects that define the fields for this dataclass. Accepts either a dataclass, or an instance of a dataclass. Raises TypeError if not passed a dataclass or instance of one. Does not return pseudo-fields which are ClassVar or InitVar.

Syntax

PYTHON
dataclasses.fields(class_or_instance)

See Also

Field TypeError