Dataclasses: Classes That Hold Data

The @dataclass decorator writes a data-holding class's __init__, __repr__ and == for you from a list of fields with types, with defaults for the fields a call can leave out and default_factory for a fresh list in every object.

By

Updated

Cheat sheet: Dataclasses: Classes That Hold Data
Category
Python
Level
Journeyman
Tags
__str__ and __repr__, Dataclass, Decorator (python), Mutable Default Argument, OOP, python, Type Hint