2
Introducing Essential Functional Concepts
Most of the features of functional programming are already part of the Python language. Our goal in writing functional Python is to shift our focus away from imperative (procedural or object-oriented) techniques as much as possible.
We’ll look at the following functional programming topics:
In Python, functions are first-class objects.
We can use and create higher-order functions.
We can create pure functions very easily.
We can work with immutable data.
In a limited way, we can create functions that have non-strict evaluation of sub-expressions. Python generally evaluates expressions strictly. As we’ll see later, a few operators are non-strict.
We can design functions that exploit eager versus lazy evaluation.
We can use recursion instead of an explicit loop state.
We have a type system that can apply to functions and objects.
This expands on the concepts from the first chapter: firstly, that purely functional programming...