5
Functional Programming – Readability Versus Brevity
This chapter will show you some of the cool tricks that functional programming in Python gives you, and it will explain some of the limitations of Python’s implementation. For learning and entertainment, we will also briefly discuss the mathematical equivalent using lambda calculus, using the Y combinator as an example.
The last few paragraphs will list and explain the usage of the functools
and itertools
libraries. If you are familiar with these libraries, feel free to skip them, but note that some of these will be used heavily in the later chapters about decorators (Chapter 6), generators (Chapter 7), and performance (Chapter 12).
These are the topics covered in this chapter:
- The theory ...
Get Mastering Python - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.