http://d.puremagic.com/issues/show_bug.cgi?id=5077
--- Comment #4 from bearophile_h...@eml.cc 2010-10-22 04:55:33 PDT --- Sorry, I have forgotten a Python version of the code: from random import random, seed from operator import itemgetter SortType_none = 0 SortType_sort = 1 SortType_schwartz = 2 DATA_LEN = 1000 # ********** sort_type = SortType_schwartz def main(): seed(1) data = [(random(), random()) for _ in xrange(DATA_LEN)] if len(data) < 50: print data if sort_type == SortType_schwartz: data.sort(key=itemgetter(1)) data.sort(key=itemgetter(0)) data.sort(key=itemgetter(1)) if sort_type == SortType_sort: data.sort(cmp=lambda a, b: cmp(a[1], b[1])) data.sort(cmp=lambda a, b: cmp(a[0], b[0])) data.sort(cmp=lambda a, b: cmp(a[1], b[1])) if len(data) < 50: print data main() -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------