28. Lambdas

If you have one-liner functions, avoid using function declaration with def. Instead, use lambda.

28.1. Don’t do this

1def add_one(x):
2    return x + 1
3
4add_one(3)

28.2. Do this

1add_one = lambda x: x + 1
2
3add_one(3)