
What are they? How to use them?



- __init__
- __repr__
- __eq__
to the class and returns the same class it was given.

as function parameters. Their values are set to instance attributes with the same names.
For example, you can define User with fields id and name.


- class name
- field names
- field representation
The order of fields is the same as the order of their definition in a class

It supports only instances of the same class
True is returned if:
- current and other are of the same class
- fields of both have the same values
For example


It adds methods:
- __lt__
- __le__
- __gt__
- __ge__
They are implemented in the same way as __eq__

In such case dataclasses.FrozenInstanceError is raised if you try to reassign instance attribute


https://www.python.org/dev/peps/pep-0557/
https://docs.python.org/3/library/dataclasses.html#module-dataclasses