def sort_by_attr(seq, attr):
 intermed = map(None, map(getattr, seq, ((attr,) * len(seq))), xrange(len(seq)), seq)
 intermed.sort()
 return map(operator.getitem, intermed, (((-1),) * len(intermed)))

def sort_by_attr ( seq , attr ) : intermed = map ( None , map ( getattr , seq , ( ( attr , ) * len ( seq ) ) ) , xrange ( len ( seq ) ) , seq ) intermed . sort ( ) return map ( operator . getitem , intermed , ( ( ( - 1 ) , ) * len ( intermed ) ) )
sort the sequence of objects by objects attribute arguments: seq - the list or any sequence of objects to sort .