Skip to content

Glossary: Software Design Patterns

@dataclass

Also written: dataclass, dataclasses

A decorator that writes `__init__` (and more) for a class from its listed fields. `@dataclass(frozen=True)` makes the fields unchangeable after creation.

Where the book teaches it

Related terms

Copying templates (copy.deepcopy, dataclasses.replace)Frozen dataclassPrototype