Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't understand your point. Are you saying that `__eq__` shouldn't be implemented at all? There's a switch for that, too.


I was merely noting that dataclasses are mostly intended for data holder objects (hence data classes), and thus defaulting to structural equality makes perfect sense, even ignoring it being overridable or disableable.

This was in reply to this objection:

> eq is a property of the domain itself; two objects are only equal if it makes sense in the domain logic for them to be equal, and in many cases that equality is more or less complicated than attribute equality.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: