On Jan 9, 12:19 pm, Bruno Desthuilliers <bruno. [EMAIL PROTECTED]> wrote: > Andrew Savige a écrit : > > and the -x hack above to > > achieve a descending sort feels a bit odd to me, though I couldn't think > > of a better way to do it. > > The "other" way would be to pass a custom comparison callback to sort, > which would be both slower and more complicated. Your solution is IMHO > the right thing to do here.
Both list.sort and sorted have a parameter 'reverse' which does a descending rather than ascending sort. eg. deco.sort(reverse=True) for v, k in deco: ... or for v, k in sorted(deco, reverse=True): ... -- Paul Hankin -- http://mail.python.org/mailman/listinfo/python-list