class SomeClass(object):
    someattribute = "somevalue"
    def __eq__(self, other):
        return self.someattribute == other.someattribute
    def __hash__(self):
        return hash(self.someattribute)
    def __ne__(self, other):
        return not self.__eq__(other)

list_of_objects = [SomeClass()]
print(SomeClass() in list_of_objects)

set_of_objects = set([SomeClass()])
print(SomeClass() in set_of_objects)
