If you want the ==
to work, then implement the __eq__
method in your class to perform the rich comparison.
If all you want to do is compare the equality of all attributes, you can do that succinctly by comparison of __dict__
in each object:
class MyClass:
def __eq__(self, other) :
return self.__dict__ == other.__dict__