class HashMyAttr:

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

def __hash__(self):
    return self.obj.my_attr.__hash__()

def __eq__(self, other):
    return self.obj.my_attr == other.obj.my_attr
Best way of removing duplicates from a list by object attribute