O'Reilly logo
live online training icon Live Online training

Functional Programming in Python

enter image description here

Code better and faster

Topic: Software Development
Julian Zucker

Some believe that functional programming isn’t useful for application development or that coding using functional programming is slower than object-oriented programming. But that just isn't so.

Join expert Julian Zucker to take a deep dive into functional programming concepts, discover where they’re useful, and learn how to apply them to programming in Python. You’ll explore concepts such as higher-order functions, type systems, higher-kinded types, immutable data structures, and referential transparency. Then, as you work through a set of Jupyter Notebook exercises, you’ll get hands-on to write new code, refactor existing code, and add types to existing codework—invaluable experience you can take into your personal projects or day job.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • The fundamentals of functional programming
  • The tools that Python provides for functional programming
  • The benefits of using functional programming for real-world development

And you’ll be able to:

  • Write code with fewer bugs by using immutability and type systems
  • Use mypy to add types to a Python codebase
  • Write more-understandable code by having well-defined service boundaries
  • Take advantage of functional tools in Python’s standard library

This training course is for you because...

  • You want to level up your software engineering abilities by learning a skill that will let you avoid bugs and write code faster.
  • You want to be able to use Python’s standard library to its fullest extent.
  • You want to be able to use types in Python to make your code safer.
  • You want to learn how functional programming concepts you know in other languages can be applied to Python.


  • A working knowledge of Python (e.g., list comprehensions, defining classes and functions, and using decorators)—see recommended preparation for useful resources
  • Software development experience (useful but not required)

Recommended preparation:

If you need a Python refresher:

Recommended follow-up:

About your instructor

  • Julian Zucker is a machine learning engineer at Klaviyo, where he uses functional programming concepts to productionize ML models. Previously, he developed an open source time series database at Pivotal and created large-scale data processing systems for analytics at PayPal. He’s published several papers, including one in AAAI about a novel method of resolving ambiguity in orderings of directed graphs. He’s the lead maintainer of an open source library that implements social choice methods, built on top of the NetworkX graph library.


The timeframes are only estimates and may vary according to how the class is progressing

Introduction to functional programming (15 minutes)

  • Presentation: Immutable data structures; pure functions; first-class functions; higher-order functions; lazy evaluation; recursion; type systems; referential transparency
  • Jupyter Notebook exercise: Review graph theory
  • Group discussion: Where have you seen these concepts used in Python’s standard library or in other languages?
  • Q&A

Immutable data structures (40 minutes)

  • Presentation: Arrays versus tuples; classes versus NamedTuples; “setting” fields of immutable data structures
  • Jupyter Notebook exercises: Implement a data structure using both approaches; write functions that operate on immutable data structures
  • Group discussion: Pros and cons of both approaches
  • Q&A

Break (5 minutes)

Functions and design patterns (55 minutes)

  • Presentation: Functions versus classes; translating common design patterns to FP
  • Jupyter Notebook exercise: Write a class that uses a function instead of the strategy pattern
  • Group discussion: When might you want to use each property of these graphs?
  • Q&A

Break (5 minutes)

Type systems (55 minutes)

  • Presentation: Type system basics; types with mypy; higher-kinded types
  • Jupyter Notebook exercise: Write code with types, including higher-kinded types
  • Group discussion: When would using types make coding slower versus faster? Safer versus less safe?
  • Q&A

Break (5 minutes)

Python standard library (60 minutes)

  • Presentation: Functional programming tools in the Python standard library; how they can help you write safe, performant code
  • Jupyter Notebook exercise: Use an LRU cache, cached properties, and dispatch
  • Q&A