Functional programming in Python with PyToolz
summary
Library demo of toolz and cytoolz shows concrete utilities (pipe, compose, curry, memoize, dicttoolz, itertoolz) that extend itertools/functools and target real tasks: pipelined word counting and a Markov-chain genome scan. Curried functions and lazy iterators compose cleanly; groupby is claimed as the fastest pure-Python impl. Replacing pure-Python toolz calls with cytoolz speeds a genomic example from about seven seconds to two seconds, so the APIs are practical and the Cython backend noticeably speeds heavy workloads.
AI-written summary · about
chapters (17)
- 0:00Intro
- 2:59We don't need everything from functional programming languages
- 4:27PyToolz brings elements of functional programming to Python
- 5:13Functional programming is a paradigm
- 6:31languages change, style endures
- 9:33Is Python a functional programming language?
- 9:58Many functional elements built-in
- 11:03first-class citizens in Python
- 13:36Another perspective: Shell scripting!
- 16:56compose(*funcs): simple but effective
- 18:41curry is a more advanced partial
- 22:56Making decorators easier with curry
- 25:57@memoize decorator is curried: simple usage
- 26:58cache keyword usage
- 28:23memoize: "how" vs "what"
- 29:26Remember map, reduce, filter, etc?
- 36:55Final sales pitch for toolz
related talks
02h 28mFunctional Python
39mFunctional Programming in Python
25mThe Standard Library Tour
33mA tour of the module itertools
33mPythonic `functional` (`iter`)tools for your data challenges
29mWriting Functional Code in Python
28mSimplifying Python Code through the Lens of Functional Programming
03h 40mTyping
