dwelden wrote: > > L.sort(key=lambda r: r.secondary, reverse=True) > > L.sort(key=lambda r: r.primary) > Excellent! That looks just like what I needed.
Note that there is the (probably little used) operator.attrgetter()
too, with that you can avoid the possibly slow lambda:
L.sort(key=attrgetter("primary")
operator.itemgetter(n) is when you have items that can be be accessed
by index.
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
