Python public recipes
Shortcut: class.new_with_eq
class ClassName:
def __init__(self, attribute):
self.attribute = attribute
def __eq__(self, other):
if isinstance(other, ClassName):
return self.attribute == other.attribute
return False