Blurbs ansible coffeescript django dvcs erlang es6 hg javascript json lua mercurial peewee postgresql python scope sql sqlalchemy yaml

Sort list of tuples code pythonerlang

a = [(1, 2), (3, 4), (5, 6)]
sorted(a, cmp=lambda a, b: b[1] - a[1])
# [(5, 6), (3, 4), (1, 2)]

from operator import itemgetter
sorted(a, key=itemgetter(1), reverse=True)
# [(5, 6), (3, 4), (1, 2)]
A = [{1, 2}, {3, 4}, {5, 6}].
lists:sort(fun({_, A}, {_, B}) -> A >= B end, A).
% [{5,6},{3,4},{1,2}]

lists:reverse(lists:keysort(1, A)).
% [{5,6},{3,4},{1,2}]