Dataclass
Dataclasses, introduced in Python 3.7, provide a decorator and functions for automatically adding special methods like `__init__`, `__repr__`, `__eq__`, and `__hash__` to user-defined classes. The guide walks through Basic Dataclasses, Field Configuration, Frozen & Ordered, Post-Init & Inheritance, Slots & Performance. `@dataclass` above a class definition auto-generates methods. Fields are declared with type annotations: `name: str`. Default values: `name: str = 'default'`. The generated `__init__` matches the field order. `__repr__` shows field names and values. `__eq__` compares all fields. `field(default=value)` provides advanced field options. `default_factory=list` creates a new list per instance (avoid mutable defaults). `init=False` excludes from `__init__`. `repr=False` excludes from `__repr__`. `compare=False` excludes from equality checks. `metadata` stores custom data. `@dataclass(frozen=True)` makes instances immutable, like a named tuple but with full type annotations. Modifying a frozen attribute raises `FrozenInstanceError`. `order=True` generates `__lt__`, `__le__`, `__gt__`, `__ge__` for sorting. Instances are compared field-by-field. The guide is organized into 5 sections that build on each other, each pairing a prose explanation with runnable code.