From Python's Functional Primitives to Parallelism - Real Python
From Python's Functional Primitives to Parallelism
Dan Bader 38 Lessons 2h 14m advanced pythonIn this course, you'll learn how to approach functional programming in Python . You'll revisit the absolute basics of Functional Programming (FP), using immutable data structures, and the filter(), map(), and reduce() functions.
Note: For a dedicated overview of the basics of functional programming in Python, go to Using Functional Programming in Python . Then, come back here to check your understanding and deepen your knowledge.
After revisiting the functional primitives, you'll see hands-on examples of common FP patterns and learn actionable tips for parallelizing your code to make it run faster.
You'll cover:
- What functional programming is
- How you can use immutable data structures to represent your data
- How to use
filter(),map(), andreduce() - How to do parallel processing with
multiprocessingandconcurrent.futures
What's Included:
- 38 Lessons
- Video Subtitles and Full Transcripts
- Translated Subtitles in 8 Languages
- 6 Hands-On Coding Exercises
- Q&A With Python Experts: Ask a Question
- Certificate of Completion
Section 1: Immutable Data Structures
7 Lessons 25m
- 1. Functional Programming Course Overview 01:15
- 2. What Is Functional Programming? 04:02
- 3. Mutable Data Structures: Lists and Dictionaries 03:48
- 4. Immutable Data Structures: namedtuple 03:39
- 5. Danger Zone: Mixing Mutable and Immutable Data Structures 01:35
- 6. Immutable Data Structures: Tuples 02:56
- 7. Exercise: Build an Immutable Scientist Dataset 08:30
Section 2: The filter() Function
6 Lessons 21m
- 1. The filter() Function: Overview 00:43
- 2. What Is the filter() Function? 03:17
- 3. Storing Filtered Data in a Tuple 02:39
- 4. Why Use the filter() Function? 03:46
- 5. Filtering List Comprehensions 03:33
- 6. Exercise: Filter the Nobel Winners 08:00
Section 3: The map() Function
6 Lessons 20m
- 1. The map() Function: Overview 00:53
- 2. What Is the map() Function? 02:13
- 3. How to Use the map() Function 04:25
- 4. The map() Function vs Generator Expressions 02:28
- 5. Why Use the map() Function? 01:50
- 6. Exercise: Compute Ages With map() 08:30
Section 4: The reduce() Function
5 Lessons 24m
- 1. The reduce() Function: Overview 01:33
- 2. What Is the reduce() Function? 04:49
- 3. Why Use the reduce() Function? 06:25
- 4. Grouping Data With itertools.groupby() 03:20
- 5. Exercise: Group Scientists by Field With reduce() 08:30
Section 5: Parallel Processing With multiprocessing
8 Lessons 24m
- 1. Parallel Processing With multiprocessing: Overview 00:48
- 2. Multiprocessing Testbed Overview 03:40
- 3. The multiprocessing Module 01:03
- 4. Measuring Execution Time in the multiprocessing Testbed 02:07
- 5. How to Create a multiprocessing.Pool() Object 01:40
- 6. How to Use multiprocessing.Pool() 05:14
- 7. Parallel Processing With multiprocessing: Conclusion 01:35
- 8. Exercise: Parallelize a Transform With multiprocessing 08:00
Section 6: Parallel Processing With concurrent.futures
6 Lessons 17m
- 1. Parallel Processing With concurrent.futures: Overview 01:55
- 2. The concurrent.futures Module 02:45
- 3. How Functional Programing Makes Parallel Processing Simple 01:38
- 4. concurrent.futures vs multiprocessing 01:06
- 5. When to Use concurrent.futures or multiprocessing 02:24
- 6. Exercise: Run a Parallel map() With concurrent.futures 08:00
About Dan Bader
Dan is the owner and editor-in-chief of Real Python and the main developer of the realpython.com learning platform. Dan has been writing code for more than 20 years and holds a master's degree in computer science.
» More about DanEach 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:
Joanna
Tappan
Related Courses:
Speed Up Python With Concurrency
samuelebright
Thank you Dan for this course. I'm looking forward to storing data from Excel sheets in immutable data structures and then using some of the strategies from the videos to manipulate the data for use in my programs.
squeakyboots
Thanks so much for this course! I'm excited to try applying this to my own API calls when something might be running more slowly than I'd like.
paulagm12
Great course! It is explained in a very clear way and I have learnt a lot of new and useful things to put into practise in my programming. I really appreciate all the effort put into this.
Ghani
This functional programming course is really excellent! Although I need to revise it and chew it again, I learned plenty of ways I can make my code more efficient. Thanks Dan.
milangnjatovic
Great course and even greater presentation. Keep it up.
bennjuguna0
Honestly thought it would be harder than this. Many thanks to you for the awesome tutorials.
George Yeboah
Good tutorial I really enjoyed watching it and picking up some cool techniques from it Great work keep it up
zorion
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!
tinachoudhary
Thanks a lot for the tutorial, it is explained well.
Axel FAUVEL
Thanks a lot for this course, very well explained :)
Donna van Wyk
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.
Shay Elmualem
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.
senatoduro8
Thanks Dan. This tutorial is great! It did help me learn new was to use the map , reduce and apply functions creatively.
konk
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.