Paddy a écrit : > On Jan 31, 12:35 pm, Bruno Desthuilliers <bruno. (snip) >>Also, using comparison functions is usually not the most efficient way >>to do such a sort. In your case, I'd go for a good old >>Decorate/sort/undecorate (AKA schwarzian transform): >> >>events = [evt for date, evt in >> sorted([(evt[2], evt) for evt in events])] >> >>HTH > > > I agree with you B., but see the comments here: > http://www.biais.org/blog/index.php/2007/01/28/23-python-sorting- > efficiency > for information on the relative speeds of rolling your own DSU versus > using itemgetter and key=...
Yeps, looks like 2.5 got a real speedup wrt/ itemgetter. Nice to know, and thanks for the link (BTW, this profileit() decorator looks pretty nice too !-) -- http://mail.python.org/mailman/listinfo/python-list