[issue46739] dataclasses __eq__ isn't logical

Mark Dickinson report at bugs.python.org
Sun Feb 13 12:44:27 EST 2022


Mark Dickinson <dickinsm at gmail.com> added the comment:

Can you explain why you think the result of `a == b` should be `False` rather than `True`? By default, equality for dataclasses is structural equality, and `True` is the result that I'd expect here.

>From the [docs](https://docs.python.org/3/library/dataclasses.html#dataclasses.dataclass) for `eq`: 

> If true (the default), an __eq__() method will be generated. This method compares the class as if it were a tuple of its fields, in order

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46739>
_______________________________________


More information about the Python-bugs-list mailing list