cmpGenA very simple utility to aid in sorting | |
Download |
cmpGen Ranking & Summary
Advertisement
cmpGen Tags
cmpGen Description
cmpGen is a very simple Python utility to aid in sorting. Basically, I often want to sort a list based on a specific property or more generically a function of the values in the list. cmpGen acts as a middle layer to make this process simple.Usage: l is a list l.sort(cmpGen(someFunctionThatActsOnListElements))Example 1: Sort a list of 2-integer pairs based on second element in the pair: l=,,,,,] l.sort(cmpGen(lambda x: x)) l is now , , , , , ]Example 2: Sort based on the absolute value of list elements: l= l.sort(cmpGen(abs)) l now is Product's homepage
cmpGen Related Software