On 01/08/2018 03:25 PM, Oren Ben-Kiki wrote: > I am hard pressed to think of a case where __ne__ is actually useful.
Assuming you're talking about a case specifically for IEEE 754, I'm starting to agree. In general, however, it certainly is useful for some numpy objects (as mentioned elsewhere in this thread). > That said, while it is true you only need one of (__eq__, __ne__), you > could make the same claim about (__lt__, __ge__) and (__le__, __gt__). > That is, in principle you could get by with only (__eq__, __le__, and > __ge__) or, if you prefer, (__ne__, __lt__, __gt__), or any other > combination you prefer. This isn't true for IEEE 754. For example: >>> float('nan') < 0 False >>> float('nan') > 0 False >>> float('nan') == 0 False Also there are many cases where you don't have a < b OR a >= b. For example, subsets don't follow this. > "Trade-offs... trafe-offs as far as the eye can see" ;-) Yes few things in life are free. :) -- https://mail.python.org/mailman/listinfo/python-list