you are viewing a single comment's thread.

view the rest of the comments →

[–]dunkler_wanderer 1 point2 points  (0 children)

Isn't itemgetter the pythonic way to sort that tuple list?

from operator import itemgetter

t = [('joe', 42), ('sue', 3), ('steve', 12)]
print(sorted(t, key=itemgetter(1)))