#! /usr/bin/env python

class Test (object):

    def __init__(self, x):
        self.x = x

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

    def __ne__(self, other):
        return self.x != other.x

    def __hash__(self):
        return hash (self.x)

    def __repr__(self):
        return '%s(%s)' % (self.__class__.__name__, self.x)


t = Test (1)
s = set ([t])

print s
print t in s         # Logically True
print Test (1) in s  # Logically True
print Test (2) in s  # Logically False

t.x = 2

print s
print t in s         # Logically True
print Test (1) in s  # Logically False
print Test (2) in s  # Logically True
