On 2/3/20 3:07 PM, Sebastian Berg wrote:
That would mean adding `operator.equivalent(a, b) -> bool` which would
allow float to override the result and let
`operator.equivalent_value(float("NaN"), float("NaN))` return True;
luckily very few types would actually override the operation.

You misunderstand what's going on here.  Python deliberately makes float('NaN') != float('NaN'), and in fact there's special code to ensure that behavior.  Why?  Because it's mandated by the IEEE 754 floating-point standard.


This bizarre behavior is often exploited by people exploring the murkier corners of Python's behavior.  Changing it is (sadly) not viable.