Chapter 16. Functional-Style Programming

Functional-style programming is an approach to programming where computations are built up from combining functions that don’t modify their arguments and that don’t refer to or change the program’s state, and that provide their results as return values. One strong appeal of this kind of programming is that (in theory), it is much easier to develop functions in isolation and to debug functional programs. This is helped by the fact that functional programs don’t have state changes, so it is possible to reason about their functions mathematically.

Three concepts that are strongly associated with functional programming are mapping, filtering, and reducing. Mapping involves taking a function and an ...

Get Advanced Python 3 Programming Techniques 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.