Functional Programming in Python

Dan Bader

Dan Bader 32 Lessons 1h 25m
advanced python

In this course, you’ll learn how to approach functional programming in Python. You’ll start with the absolute basics of Functional Programming (FP). After that, you’ll see hands-on examples for common FP patterns available, like using immutable data structures and the filter(), map(), and reduce() functions. You’ll end the course with actionable tips for parallelizing your code to make it run faster.

You’ll cover:

  1. What functional programming is
  2. How you can use immutable data structures to represent your data
  3. How to use filter(), map(), and reduce()
  4. How to do parallel processing with multiprocessing and concurrent.futures

About Dan Bader

Dan Bader Dan Bader

Dan is the Chief Python Nut at Real Python. He helps Python developers take their coding skills to the next level with Python tutorials, books, and online training.

» More about Dan

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Participant Comments

konk on July 5, 2019

Good tutorial. I’d read about python multiprocessing/threading, but had not yet implemented it. Seeing it in action in this tutorial - wow - quite easy to get going. No reason not to implement when it will help.

senatoduro8 on July 25, 2019

Thanks Dan. This tutorial is great! It did help me learn new was to use the map, reduce and apply functions creatively.

Shay Elmualem on Aug. 3, 2019

This is great stuff Dan, thanks! I normally, out of habit, just go with the “manual” approach of iterating/looping over and just getting/saving the data I need, I really need to start using these built-ins more! very cool.

Donna van Wyk on Sept. 24, 2019

Wow. I’ve been learning about python a lot of diff ways. Your “simple” explanation of a lambda here finally made it click. I am so excited to go thru all of the courses and really get somewhere.

mikesult on March 3, 2020

Great tutorial in functional programming. I learned a lot. I’d like to share a newbie mistake I made in the last section. I typed in the code from the video but I named it concurrent.py (bad mistake) and when I tried to run, it caused an error:

ModuleNotFoundError: 
No module named 'concurrent.futures'
'concurrent' is not a package

I fumbled with this for most of the day trying to figure out the problem before I finally found a post from a few years back on stackoverflow that had the same error and one of the answering comments included ‘…Either that or you’re shadowing concurrent. Do you have a concurrent.py?’

Umm, yes I do.

Once I renamed the file it worked as expected.

So I learned that you shouldn’t name your file the same name as a package name. Of course it seems so obvious now.

Thanks for a great intro to the functional programming style.

Axel FAUVEL on March 27, 2020

Thanks a lot for this course, very well explained :)

tinachoudhary on April 6, 2020

Thanks a lot for the tutorial, it is explained well.

zorion on April 8, 2020

Awesome, thanks Dan! I finally understand what GIL blocks. It was always a black box for me, I knew that there was something wrong in Python parallelism but I didn’t know that it was restricted to threads while computing. Good to know, Good to know!

George Yeboah on April 10, 2020

Good tutorial I really enjoyed watching it and picking up some cool techniques from it Great work keep it up

bennjuguna0 on April 13, 2020

Honestly thought it would be harder than this. Many thanks to you for the awesome tutorials.

milangnjatovic on April 28, 2020

Great course and even greater presentation. Keep it up.

« Browse All Courses