Speaker
Al Sweigart
Material
Note
- To understand recursion, first understand stacks.
- Recursive function
- at least one base case
- recursive case
- When should we use recursion? (both requirements needed)
- tree-like structure
- backtracking
- Tail Call Optimization/Elimination
- It's a compiler trick
- But CPython doesn't implement and never will ("If you want a short answer, it's simply unpythonic" - Guido)
- It's a compiler trick
- Memoization (Cache)
functools.lru_cache
(least recently used)