On 31/03/2010 18:08, Chris Curvey wrote:
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 think this is the kind of thing you're after... http://ramblings.timgolden.me.uk/2009/10/15/reverse-sorting-on-arbitrary-key-segments/ ... at least the link to the Wiki should help: http://wiki.python.org/moin/HowTo/Sorting TJG -- http://mail.python.org/mailman/listinfo/python-list
