Functional Python

Object oriented programming makes code understandable by encapsulating moving parts. Functional programming makes code understandable by minimizing moving parts.

- Michael Feathers

Video

Functional Programming

Functional programming has a lot of different definitions. In a pure sense, it means abstractions have certain mathematical behaviors and guarantees. In a pragmatic, python-centric perspective, however, functional programming can be thought of as a collections of ideas and features. Many of these features are incredibly powerful and expressive, and found in many open-source libraries. Functional approaches also tend to be more scalable, and less bug-prone, but do require discipline and forethought.

Understanding functional concepts, including their pros and cons, will help you know in which situations your software might benefit from a functional paradigm or when another approach is a more natural fit. In this module we cover key concepts of functional programming and functional python features. We will also cover (time permitting) two other important python concepts which aren’t particularly functional; generators and context managers.

Outline

This module covers:

  1. Functional concept overview
  2. Scope, closures, higher-order functions (e.g. decorators)
  3. Anonymous functions
  4. Map, reduce
  5. Recursion
  6. *Generators, *context managers

Reading

Additional Resources