Lambda functions are just functions but typically very simple ones. It's the fact that makes them really easy to declare that makes them extremely expressive as well and in this series of videos we'd like to demonstrate not just how they work but also why they're nice to reason about.
Python functions are much like normal variables.
def double(x): return x * 2 def add_one(x): return x + 1
I can put these two functions in a list.
function_list = [double, add_one]
These functions have not executed just, but I can keep them around to run later. That's what is happening in this block of code;
number = 1 for func in [add_one, double, add_one]: number = func(number) print(number)
Make sure that you understand what is happening in this block of code.
Feedback? See an issue? Something unclear? Feel free to mention it here.
If you want to be kept up to date, consider signing up for the newsletter.