asdict
asdict is a function from Python's standard library dataclasses module. It returns a dictionary representation of a dataclass instance by recursively converting its fields to dictionaries when appropriate. The function requires a dataclass instance and will raise a TypeError if given a non-dataclass object.
When applied to a dataclass, asdict includes each field in the output dictionary under its field name.
asdict is commonly used to prepare dataclass data for serialization, such as JSON encoding, since a dataclass
Some practical notes: asdict preserves a deep copy-like behavior for dataclass structures, producing new dicts and