[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