Preface
Who this book is for
This book is for programmers who want to create succinct, expressive Python
programs by borrowing techniques and design patterns from functional programming
languages. Some algorithms can be expressed elegantly in a functional style; we can—
and should—adapt this to make Python programs more readable and maintainable.
In some cases, a functional approach to a problem will also lead to extremely high
performance algorithms. Python makes it too easy to create large intermediate data
structures, tying up memory and processor time. With functional programming
design patterns, we can often replace large lists with generator expressions that are
equally expressive, but take up much less memory and run much more quickly.
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
Code words in text are shown as follows: "We can create a Pool object of
concurrent worker processes, assign tasks to them, and expect the tasks to
be executed concurrently."
A block of code is set as follows:
GIMP Palette
Name: Crayola
Columns: 16
#
Any command-line input or output is written as follows:
def max(a, b):
f = {a >= b: lambda: a, b >= a: lambda: b}[True]
return f()
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.