Improving upon the Decorate-Sort-Undecorate idiom

Thomas Philips tkpmep at hotmail.com
Tue Jun 22 16:12:23 EDT 2004


I recently had the need to sort a large number of lists of lists, and
wondered if an improvement to the Decorate-Sort-Undecorate idiom is in
the works. Ideally, I would like to sort the list of lists (or tuples)
in place by using a simple variant of the current idiom, i.e.

list_of_lists.sort(*columns)

where *columns is a tuple that specifies the column order for the
sort. If *columns is left blank, the sort ought to work as it does
today, i.e.

list_of_lists.sort()

should sort by columns 0, 1,2,.....

Has such a method been considered for inclusion in Python? Does it
have any problems that would inhibit its adoption?

Thomas Philips



More information about the Python-list mailing list