Lambda (anonymous function)
Applies to: python, general
A lambda is a small unnamed function written inline, typically passed to another function (a higher-order
function) like sorted, map, or a key function. In C++ lambdas can also capture surrounding variables.
pairs.sort(key=lambda p: p[1]) # sort by the second element
double = lambda x: x * 2
See also: function