In brief
The dataclass decorator can generate initialization and representation methods from declared fields. Type annotations describe those fields but do not themselves check every value at runtime.
Useful to know
The dataclass decorator can generate initialization and representation methods from declared fields. Type annotations describe those fields but do not themselves check every value at runtime. [1]
When importing a price or quantity, separate conversion and constraints from the data container. A convenient constructor does not prove a number is positive. For mutable defaults, consider default_factory instead of sharing one list across instances.
Sources
For further detail and to check the information: