References (and function calls in some cases) are about as simple as you can get. Lambdas aren't too bad, but a bit more complicated. Functions from operator can also be faster than equivalent lambdas.
I feel that these are most common for itemgetter, attrgetter and methodcaller.
Example
# Bad
lambda a, b: a < b
lambda a: not a
lambda a: a.fish
lambda x: x[0]
lambda x: (x[0], x[3])
# Good
operator.lt
operator.not_
operator.attrgetter("fish")
operator.itemgetter(0)
operator.itemgetter(0, 3)
Explanation
References (and function calls in some cases) are about as simple as you can get. Lambdas aren't too bad, but a bit more complicated. Functions from operator can also be faster than equivalent lambdas.
I feel that these are most common for
itemgetter
,attrgetter
andmethodcaller
.Example