def __hash__(self):
    return hash(self.s)
instance1, instance2 = MyClass('a'), MyClass('a')
instance3 = MyClass('b')
print(instance2 == instance1)
print(instance2 in [instance1])
print(instance2 in set([instance1]))
In python - the operator which a set uses for test if an object is in the set