Nick Coghlan wrote:
Perhaps the check could be:
(type(lhs) == type(rhs) or fields(lhs) == fields(rhs)) and all
(individual fields match)
I think the types should *always* have to match, or at least
one should be a subclass of the other. Consider:
@dataclass
class Point3d:
x: float
y: float
z: float
@dataclass
class Vector3d:
x: float
y: float
z: float
Points and vectors are different things, and they should never
compare equal, even if they have the same field names and values.
--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com