class Ind(object):

    def __init__(self, ID, mate):
        self.ID = ID
self.mate = mate

def __repr__(self):
    return 'Ind({},{})'.format(self.ID, self.mate)
population = [Ind(8, None), Ind(1, 2), Ind(2, 3), Ind(2, 1), Ind(12, None),
    Ind(3, 2), Ind(10, 11), Ind(11, 10)]

def custom_sort(pop):
    pass
Python: сортировка списка по двум атрибутам