Dataclasses @dataclass generates init, repr and eq from type-annotated fields — the Pythonic way to write data-holding classes. Option Effect frozen=True immutable + hashable order=True generates <, > … for sorting slots=True (3.10) less memory, faster attribute access field(defaultfactory=list) safe mutable defaults postinit validation / derived fields Magic (dunder) methods Implementing special methods lets your objects work with built-in syntax: Method Enables repr / str debugging / user-facing text eq, lt, hash comparisons, sorting, set/dict keys len, getitem, iter, contains sequence behaviour, for, in add, mul … operators call call the object like a function enter / exit with statement Class tools @property for computed attributes, @classmethod for alternative constructors…