Comment 7 for bug 1586268

Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

I think this is true. I executed this piece of code under different python

    class Resource(object):
    def __init__(self, person):
        self.person = person

    def __eq__(self, other):
        return self.person == other.person

    r1 = Resource("test")
    r2 = Resource("test")
    r3 = Resource("test_r3")
    r4 = Resource("test_r4")

    print(r1 != r2)
    print(r1 == r2)
    print(r3 != r4)
    print(r3 == r4)

Python 2.7.10 Python 3.5.1
        True False
        True True
        True True
        False False

Also, The python3 doc [1] says:

    "By default, __ne__() delegates to __eq__() and inverts the result
    unless it is NotImplemented. There are no other implied relationships
    among the comparison operators"

whereas the python2 doc [2] says:

    "There are no implied relationships among the comparison operators."

I think this behavior change got introduced in python with [3]. As long as
we support python2, a change seems to be reasonable.