Writing Functional Code in Python
summary
Claims that Python can be written in a functional style and shows concrete tools and results: uses recursion and itertools.reduce to remove mutation, publishes a small library you can pip install pi-effects, demonstrates Option and Try wrappers to make emptiness and exceptions explicit, and runs parallel tasks with futures to combine results. Example combines two threads (3s and 5s) to produce 150 in about 5s, shows an error case where one future fails, and uses future.traverse to invert lists of futures into a future of list.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:33What is functional programming
- 4:18Pure functions and referential transparency
- 7:06Eliminating mutable state with recursion
- 8:54Higher-order functions and reduce
- 9:37Handling emptiness with Option
- 14:07Managing exceptions with Try
- 19:24Concurrency with Futures
- 23:38Combining Futures efficiently
- 25:22Key takeaways from functional programming
- 26:25Q&A
related talks
30mFunctional Programming in Python
27mFunctional Programming for Pythonistas
39mFunctional Programming in Python
43mFunctional Programming in an Imperative World. Maybe
02h 43mFunctional Python
33mPythonic `functional` (`iter`)tools for your data challenges
01h 14mThe Five Kinds of Python Functions
46mOn Being Pythonic
