Python is not a functional programming language, but it is a multi-paradigm language that makes functional programming easy to perform, and easy to mix with other programming styles. In this paper, David Mertz, a director of Python Software Foundation, examines the functional aspects of the language and points out which options work well and which ones you should generally decline.
Mertz describes ways to avoid Python’s imperative-style flow control, the nuances of callable functions, how to work lazily with iterators, and the use of higher-order functions. He also lists several third-party Python libraries useful for functional programming.
- Using encapsulation and other means to describe "what" a data collection consists of, rather than "how" to construct a data collection
- Creating callables with named functions, lambdas, closures, methods of classes, and multiple dispatch
- Using Python’s iterator protocol to accomplish the same effect as a lazy data structure
- Creating higher-order functions that take functions as arguments and/or produce a function as a result
Table of contents
- 1. (Avoiding) Flow Control
- 2. Callables
- 3. Lazy Evaluation
- 4. Higher-Order Functions
- Title: Functional Programming in Python
- Release date: May 2015
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781491928554
You might also like
Mythical Man-Month, The: Essays on Software Engineering, Anniversary Edition, 2nd Edition
Few books on software project management have been as influential and timeless as The Mythical Man-Month. …
Generative Deep Learning, 2nd Edition
Generative AI is the hottest topic in tech. This practical book teaches machine learning engineers and …
Using Asyncio in Python
If you’re among the Python developers put off by asyncio’s complexity, it’s time to take another …
Designing Data-Intensive Applications
Data is at the center of many challenges in system design today. Difficult issues need to …