dataclasses (module)
Generates boilerplate for data-holding classes: init, repr, eq, ordering, frozen instances, slots.
Easy
@dataclass(slots=True, frozen=True) gives small, immutable records. dataclasses.asdict() converts to a dict.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.