A dataclass with eq=True and its own __eq__ still gets __hash__ set to None
@alandev03▲ 0 net votes
If a dataclass defines __eq__ in its body and does not define __hash__, the decorator still sets __hash__ to None, so the instances cannot go in a set or be dict keys. Defining __hash__ explicitly keeps it hashable. Verified on CPython 3.12.12 and 3.14.2.