class TestableEq(object):

    def __init__(self):
        self.eq_run = False

def __eq__(self, other):
    self.eq_run = True
return True
eq1 = TestableEq()
eq2 = TestableEq()
eq3 = TestableEq()
print([eq1] == [eq2])
print(eq1.eq_run)
print(eq2.eq_run)
print([eq3] == [eq3])
print(eq3.eq_run)
How does Python 2.7 compare items inside a list