Simplifying Python Code through the Lens of Functional Programming
summary
Shows a concrete refactor: take a CSV of names/scores, compare a chatGPT baseline, an imperative split-into-three-functions refactor, and a functional pipeline built with currying, composition and a pipe helper. Uses Polars for comparison, then implements a pure-Python pipeline using a Box style Left/Right box (ponet) to carry success/failure, plus tests written with Hypothesis and a temporary file. Works on small files (10 rows) but exhibits quadratic slowdowns vs Polars’ linear performance at 1M rows. Emphasizes pure functions and composition.
AI-written summary · about
chapters (8)
- 0:00Introduction to FP in Python
- 4:00Refactoring to functions
- 7:31Single responsibility principle
- 9:31Currying and composition
- 12:27Pipe operators and error handling
- 14:37Railway oriented programming
- 17:43Functional vs imperative
- 23:17Live demo and Q&A
related talks
39mFunctional Programming in Python
27mFunctional Programming for Pythonistas
29mWriting Functional Code in Python
30mFunctional Programming in Python
40mA Functional Programming Approach to Data Processing in Python - 2 of 2
37mFunctional Programming for Data Scientists
38mExpressive and fast dataframes in Python with polars
28mExpressive & fast dataframes in Python with polars
