mailing list wrote: > No-one's mentioned a Schwartzian Transform yet ; )
because it's obsoleted by the key parameter to sort... > > > > On 8/15/05, Kent Johnson <[EMAIL PROTECTED]> wrote: > >>[EMAIL PROTECTED] wrote: >> >>>Note that in Python2.4+, you can use key= instead: >>> >>>def sortKey(lst): >>> return lst[2] >>>Quant.sort(key=sortKey) >>> >>>This is more effient than specifying a different comparison function, because >>>the key function is only called once for each element. >> >>And instead of defining your own function you can use itertools.itemgetter() >>which is intended for this purpose: >>import itertools >>Quant.sort(key=itertools.itemgetter(2)) >> >>Kent >> >>_______________________________________________ >>Tutor maillist - Tutor@python.org >>http://mail.python.org/mailman/listinfo/tutor >> > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor