Five Kinds of Python Functions
summary
Defines five concrete function forms and shows what each actually buys: plain defs for single-expression returns, higher-order map chains are lazy with composition and zip to build a tachometer→engine table (curve fit plus rounding to nearest 100), lambda for one-off keys, callable objects (.__call__) implementing memoized factorial that speeds repeats, generators that yield lazily to avoid huge lists, and decorators using functools.lru_cache to cut runtime on Project Euler examples.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 11:58Mathematical foundations
- 26:59Higher-order functions
- 50:39Wrappers for class methods
- 55:43Generator expressions
- 1:05:05Lambda functions
- 1:12:55Memoization
- 1:21:41Decorators
- 1:25:20Generator functions
- 1:31:05Summary








