Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Python Generators 101 (Overview)

Have you ever had to work with a dataset so large that it overwhelmed your machine’s memory? Or maybe you have a complex function that needs to maintain an internal state every time it’s called, but the function is too small to justify creating its own class. In these cases and more, generators and the Python yield statement are here to help.

By the end of this course, you’ll know:

  • What generators are and how to use them
  • How to create generator functions and expressions
  • How the Python yield statement works
  • How to use multiple Python yield statements in a generator function
  • How to use advanced generator methods
  • How to build data pipelines with multiple generators

If you’re a beginner or intermediate Pythonista and you’re interested in learning how to work with large datasets in a more Pythonic way, then this is the course for you.


Sample Code (.zip)

25.2 KB


Course Slides (.pdf)

7.3 MB

Comments & Discussion

William on June 18, 2020

Please, I cannot play the videos, I am now in China but not sure whether that’s the trouble.

Ricky White RP Team on June 18, 2020

Hi William. We use Vimeo to serve our videos, so if that service is blocked in your region, I’m afraid they won’t work without a VPN. But I know VPNs are also illegal in China, so I would not like to advocate you do anything illegal. But in theory it should work.

Become a Member to join the conversation.