def selBest(individuals, k):
 return sorted(individuals, key=attrgetter('fitness'), reverse=True)[:k]

def selBest ( individuals , k ) : return sorted ( individuals , key = attrgetter ( 'fitness' ) , reverse = True ) [ : k ]
select the *k* best individuals among the input *individuals* .