1mylist = sorted(mylist, key=itemgetter('name', 'age'))
2mylist = sorted(mylist, key=lambda k: (k['name'].lower(), k['age']))
3mylist = sorted(mylist, key=lambda k: (k['name'].lower(), -k['age']))
4
1>>> def multisort(xs, specs):
2... for key, reverse in reversed(specs):
3... xs.sort(key=attrgetter(key), reverse=reverse)
4... return xs
5