Python Dataclasses Module
Data classes — dataclass, field, asdict, replace, is_dataclass. This category documents 6 Python dataclasses module entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example. The entries include: dataclasses.dataclass(), dataclasses.field(), dataclasses.asdict(), dataclasses.astuple(), dataclasses.replace(), dataclasses.is_dataclass(). dataclasses.dataclass() a decorator that generates __init__, __repr__, __eq__, and other methods for classes. dataclasses.field() customizes a single data class field (default factory, exclude from repr, etc.). dataclasses.asdict() converts a dataclass instance to a dictionary (recursively). dataclasses.astuple() converts a dataclass instance to a tuple. dataclasses.replace() creates a new dataclass instance with specified fields changed (like copy with changes). Dataclasses Module belongs to the Core Language group alongside Built-in Functions, Statements & Keywords, Typing Module, Enum Module. You can also search across every category from the search page, browse the complete A–Z index, or try any example in the Python playground.