[Python-ideas] Automatic comparisons by default
Raymond Hettinger
raymond.hettinger at gmail.com
Wed Mar 16 02:12:18 CET 2011
>>
>>> Two very related proposals:
>>>
>>> 1. On "!=", if Python doesn't find __ne__, use "not __eq__()".
>
> Isn't this implemented in Python 3?
Yes, it is :-)
>>> class A:
def __eq__(self, other):
print('hello')
return True
>>> A() == A()
hello
True
>>> A() != A()
hello
False
It seems that very few core developers really know what is currently in Python 3. That is probably a by-product of being stuck with Python 2 at work.
Raymond
More information about the Python-ideas
mailing list