Lambda ====== .. interactive_code_block:: :caption: Only eat oysters in months with an 'r' months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] def foo(month): return not 'r' in month months_without_r = list(filter(foo, months)) print(months_without_r) .. interactive_code_block:: :caption: Only eat oysters in months with an 'r' months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] months_without_r = list(filter(lambda month: not 'r' in month, months)) print(months_without_r) Lambda expressions return a function reference ---------------------------------------------- .. interactive_code_block:: :caption: sum = lambda a, b: a + b print(sum(12, 34)) .. Name origin: from 'Lambda calculus' https://en.wikipedia.org/wiki/Lambda_calculus introduced by the mathematician Alonzo Church in the 1930sn