MCPcopy Create free account
hub / github.com/ActiveState/code / sortBy

Function sortBy

recipes/Python/117237_Anagram_Fetcher/recipe-117237.py:20–23  ·  view source on GitHub ↗
(list, n)

Source from the content-addressed store, hash-verified

18
19# sort a list by a given field
20def sortBy(list, n):
21 nlist = map(lambda x, n=n: (x[n], x), list)
22 nlist.sort()
23 return map(lambda (key, x): x, nlist)
24
25if ( len(sys.argv) != 2 ):
26 print "You must pass one input file to this program. That file"

Callers 1

recipe-117237.pyFile · 0.85

Calls 2

mapFunction · 0.85
sortMethod · 0.45

Tested by

no test coverage detected