Hi all, I'm learning Python with Google's Python class
Ik have a question about the following code: ================================= def sort(var): return var[-1] #returns the last character of var def sort_last(): tup = [(1, 3), (3, 2), (2, 1)] print(sorted(tup, key=sort)) sort_last() ================================== I uderstand everything except (var) value. I understand that key=sort calls the sort function. But where comes the var value from? Does sort automatic pass the value from tup to (var) because (var) is nowhere defined. Thanks, Martin
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor