Functional Python Programming Use a functional approach to write succinct, expressive, and efficient Python code, 3rd Edition (Steven F. Lott)(Z-Library)
This book provides detailed guidance on how to use Python’s functional programming features (with Python 3.10 examples, also tested with Python 3.11).
Table of Contents:
- Understanding Functional Programming
- Introducing Essential Functional Concepts
- Functions, Iterators, and Generators
- Working with Collections
- Higher-Order Functions
- Recursions and Reductions
- Complex Stateless Objects
- The Itertools Module
- Itertools for Combinatorics – Permutations and Combinations
- The Functools Module
- The Toolz Package
- Decorator Design Techniques
- The PyMonad Library
- The Multiprocessing, Threading, and Concurrent.Futures Modules
- A Functional Approach to Web Services
- Bonus Online Chapter
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A practical guide to writing cleaner, more expressive Python by borrowing functional programming techniques—immutability, higher-order functions, lazy evaluation, and function composition—without abandoning Python's imperative and object-oriented strengths. Best for intermediate Python developers who already know the language and want to add a functional toolkit to their everyday code.
【Book Arc】
- **Opening (~0%–10%)**: Frames what functional programming means in Python terms—expressions over state changes, pure functions, and why a mixed paradigm is realistic. Uses exploratory data analysis (EDA) as the running problem domain.
- **Early (~10%–35%)**: Builds the essentials: first-class and pure functions, immutable data, strict vs. lazy evaluation, iterators and generators, working with collections, higher-order functions like map() and filter(), recursion and reductions, and stateless objects via tuples, NamedTuple, frozen dataclasses, and pyrsistent.
- **Middle (~35%–55%)**: Moves into library tooling—the itertools module (including combinatorics like Cartesian products, permutations, and combinations), the functools module (cache, partial, reduce, singledispatch, total ordering), and the toolz package.
- **Late (~55%–80%)**: Advanced design patterns—decorators as higher-order functions for cross-cutting concerns, composite design, and parameterized decorators; the PyMonad library for currying, functors, and monad bind().
- **Ending (~80%–100%)**: Applies functional thinking to concurrency (multiprocessing, threading, concurrent.futures) and web services (HTTP request-response, WSGI, services as functions), plus a bonus online chi-squared case study.
【Key Takeaways】
- **Functional programming in Python is a spectrum, not a switch** (Early): The book repeatedly stresses that Python is not purely functional; the goal is to selectively adopt functional techniques where they make code more readable and maintainable, while keeping imperative and OO features available.
- **Immutability simplifies reasoning and enables safe concurrency** (Early–Late): Tuples, NamedTuple, frozen dataclasses, and pyrsistent objects avoid inconsistent state, and the concurrency chapter ties this directly to distributing workloads without poorly synchronized writes.
- **Generators and lazy evaluation are Python's native path to functional data pipelines** (Early): Generator expressions and functions let you clean and transform raw data without materializing intermediate collections.
- **Higher-order functions and function composition are the core building blocks** (Early–Middle): map(), filter(), custom functions that accept or return functions, and composition let you build small, understandable pieces and combine them.
- **The standard library already ships serious functional tools** (Middle): itertools and functools cover iteration, combinatorics, memoization, partial application, reduction, and type-based dispatch—no third-party dependency required.
- **Decorators are the practical face of higher-order functions** (Late): They handle cross-cutting concerns and composite design, and can be parameterized for more complex behavior.
- **Monads and PyMonad are optional, advanced territory** (Late): Currying, functors, and bind() are presented as techniques for simulation and composition, not as required daily practice.
- **Functional design pays off in concurrency and web services** (Ending): Stateless functions map naturally onto process pools and onto web services modeled as request-to-reply function pipelines.
【Reading Tips】
- **Deep-read Chapters 1–7** if you are new to functional thinking; this is where the mental model is built, and later chapters assume it.
- **Skim or selectively read the library chapters (8–11)** based on what you actually use—itertools and functools are high-value; toolz is optional if you prefer the standard library.
- **Treat PyMonad (Chapter 13) as optional** unless you are specifically interested in monadic composition; it is the most niche material in the book.
- **Do the exercises and check the GitHub repository**: the book explicitly notes that partial solutions and unit tests are provided, and suggests using timeit to compare design alternatives.
- **Keep the EDA domain in mind** as a unifying thread; it makes the functional examples concrete rather than abstract.
【Coverage Limits】
This guide is based on the table of contents, preface, and stratified excerpts; the excerpts do not cover detailed code examples, the bonus online chi-squared case study, or the full content of individual chapters, so chapter-level specifics beyond their stated topics are not summarized here.
Excerpt 1
7 Applying generators to built-in collections 3.8 Summary 3.9 Exercises Join our community Discord space Chapter 4: Working with Collections 4.1 An over...
iews and tech talks at conferences are available on YouTube. Alex’s proudest achievement are the articles that appeared in Bridge World (January and February...
programs that deal with collections or generator functions. Chapter  9 , Itertools for Combinatorics – Permutations and Combinations , covers the combin...
sn’t contain a tutorial introduction to the Python language. We assume the reader knows some Python. In many cases, if the reader knows a functional programm...
seq[0] , to the sum of the remaining items, sumr(seq[1:]) . Eventually, the computation of the result involves the sum of an empty list, which is defined as...
f(a0), f(f(a0)), f(f(f(a0))),) ... ] [1.0, 1.5, 1.4167, 1.4142] We defined the f() function as a lambda that will converge on where n = 2. We started with...
s another excellent place to explore functional programming. We can describe our focus as univariate and bivariate statistics, but that sounds too daunting a...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Functional Python Programming Use a functional approach to write succinct, expressive, and efficient Python code, 3rd Edition (Steven F. Lott)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share to WeChat Moments
Functional Python Programming Use a functional approach to write succinct, expressive, and efficient Python code, 3rd Edition (Steven F. Lott)(Z-Library)
Scan the QR code with WeChat to open this book
Tap the ··· menu in the top-right corner
Choose Share to Moments
You are already in WeChat. Tap ··· in the top-right corner and choose Share to Moments.
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Functional Python Programming Use a functional approach to write succinct, expressive, and efficient Python code, 3rd Edition (Steven F. Lott)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment