Sort by value and key Python : I was searching for something to sort a list of pairs by values and keys in Python. I found this list.sort(key = lambda (k,v):(-v,k)), i tried to find some explanation about this but couldn't find anything which clarify my doubts. Can someone explain how this lambda function works?