I must be having a brain cramp.  Given a list of objects, how can I
sort the list on one attribute in descending order, then sort within
each group in ascending order on another attribute.

For example:

class Foo:
    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c


I can do "allmyfoos.sort(operator.attrgetter('a','b'))" to sort
ascending on both attributes, but how could i sort by "a, descending,
then b, ascending)?"



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to