Schwartzian transform for tuple in list

Terry Reedy tjreedy at
Thu Sep 25 05:36:18 CEST 2008

David Di Biase wrote:
> When you say slightly, is it enough to make a difference? Why would 
> getitems be faster even - not sure I can think why...

Using key is faster than cmp because key is called just once for each 
item whereas cmp is called once for each of the O(nlogn) compares.

Operator.itemgetter is written in C and hence should be faster than a 
wrapper written in Python.

More information about the Python-list mailing list