Jump to ratings and reviews
Rate this book

Functional Programming in Python

Rate this book
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.

Topics include:

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
David Mertz is a director of the Python Software Foundation, and chair of its Trademarks and Outreach & Education Committees. He wrote the columns Charming Python and XML Matters for IBM developerWorks and the Addison-Wesley book Text Processing in Python. David has spoken at multiple OSCON and PyCon events.

37 pages, ebook

First published May 1, 2015

4 people are currently reading
55 people want to read

About the author

David Mertz

11 books

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
11 (14%)
4 stars
29 (38%)
3 stars
29 (38%)
2 stars
6 (8%)
1 star
0 (0%)
Displaying 1 - 10 of 10 reviews
227 reviews27 followers
August 2, 2015
It's not very much an introduction to functional programming in Python but more an guide on how you can utilize these concepts in Python. The explanation is very good though and even for someone with very limited FP experience it was reasonable easy to follow along (although I didn't get everything).

I can highly recommend this.
1 review
November 3, 2020
You will learn the basic foundation of Functional Programming. This book has only 4 chapters.
For me this most interesting part is the Flow Control chapter. In that chapter I learn how to take the advantage of recursive technique to solve a problem in a good way, by "good way" I mean "How to eat an elephant" and recursive technique make you think how to split a big problem into smaller problems.
Profile Image for Deepak Sandhu.
24 reviews1 follower
February 24, 2018
it is condensed. but too short. it shows how functional programming can be used.
But does not teach a lot how to write functional programs.
if you are new to functional programming (in python) its a good start. but does need more than one read to get it at some topics.

its better to read a little on functional programming in general before starting this.
Profile Image for Takeshi.
5 reviews5 followers
October 27, 2017
A booklet that introduces functional programming style with a non-FP language. The contents are only as long as three or four blog articles but basically cover the most commonly used FP-style implementations in Python.
30 reviews3 followers
December 30, 2017
Provide enough information about functional programming and how does it be applied/affected in our Python code.

Short enough to read in an afternoon, simple enough to get it all in a single read. I would recommend this book for junior Python programmer.
Profile Image for Prashant Phani.
13 reviews
November 7, 2021
Was a very good book, but too short. It is a very good intro to the mindset of functional programming for someone who knows python but is new to the paradigm.
Profile Image for Jin Shusong.
78 reviews1 follower
December 7, 2021
The text is very short. But the author listed the most important skills in functional python coding.
4 reviews
September 4, 2019
This book gives a concise, although not comprehensive, overview of functional programming in Python. The length of the book suggests an introduction but a beginner in either Python or functional programming would have a hard time understanding some of the contents and examples immediately. I did take away a few pieces of knowledge from the book such as the use of the functools library.
Profile Image for Dmytro Chasovskyi.
89 reviews
May 5, 2017
I would rather not recommend this book for people who would like to view on the Python Functional Programming side without previous Functional Python experience.

The Main shortcoming of this book is lack of completely independent examples. Often they either depend on the previous code or cannot be run not being self-contained from the begging (e.g. on page 27, ```lazy = open('06-laziness.md')```) . It seems for me that book is raw and wasn't rigorously reviewed before publishing.
Displaying 1 - 10 of 10 reviews

Can't find what you're looking for?

Get help and learn more about the design.