Episode 39: Generators, Coroutines, and Learning Python Through Exercises
The Real Python Podcast
Dec 11, 2020 1h 5m
Have you started to use generators in Python? Are you unsure why you would even use one over a regular function? How do you use the special “send” method and the “yield from” syntax? This week on the show, we have Reuven Lerner to talk about his PyCon Africa 2020 talk titled “Generators, coroutines, and nanoservices.”
Episode Sponsor:
Reuven helps developers around the world become more fluent in Python. We talk about some of his teaching techniques and also how he continues to learn. Reuven is a believer in the continued practice of Python through exercises. We discuss his book “Python Workout” and his Weekly Python Exercise courses.
Course Spotlight: Python Generators 101
In this step-by-step course, you’ll learn about generators and yielding in Python. You’ll create generator functions and generator expressions using multiple Python yield statements. You’ll also learn how to build data pipelines that take advantage of these Pythonic tools.
Topics:
- 00:00:00 – Introduction
- 00:01:38 – Reuven’s web site: Teaching Python and Data Science around the world
- 00:03:39 – Training remotely and screen-time overload
- 00:07:03 – Info-tainment and sparking engagement
- 00:11:05 – PyCon Africa 2020 - Generators, Coroutines, and Nanoservices
- 00:13:34 – Using dis() - disassembler for Python bytecode
- 00:15:09 – Exceptions as signals, not exclusively for errors
- 00:17:39 – What makes generator functions different?
- 00:22:05 – Using .send() and creating a coroutine
- 00:23:39 – Sponsor: Scout APM
- 00:24:40 – Stopping the generator with .throw()
- 00:26:28 – Additional uses for generators
- 00:30:03 – Python Workout: 50 ten-minute exercises
- 00:34:22 – A combination of techniques and sources for continued learning
- 00:40:15 – Weekly Python Exercise
- 00:42:02 – Video Course Spotlight
- 00:43:08 – Bachelor degree in CS, but a Doctorate in learning sciences
- 00:48:26 – What are additional techniques you use to keep learning?
- 00:50:18 – Teaching is a great way to keep learning
- 00:51:28 – What areas of data science are you focusing on?
- 00:53:22 – The Business of Freelancing: podcast
- 00:56:26 – What is something you thought you knew about Python, but were wrong about?
- 00:59:24 – What is something you are excited about in the world of Python?
- 01:02:18 – Conferences and user groups
- 01:05:03 – Thanks and goodbye
Show Links:
- Teaching Python and Data Science around the world: Reuven’s Training Site
- Reuven’s newsletter
- Generators, Coroutines, and Nanoservices: Pycon Africa 2020
- PEP 255 – Simple Generators: Python docs
- How to Use Generators and yield in Python: Real Python article
- dis — Disassembler for Python bytecode: Python docs
- Exception Handling: Python docs
- Python Workout : 50 ten-minute exercises - Manning
- Weekly Python Exercise Course
- Luis Serrano: machine learning & math made easy - YouTube channel
- The Business of Freelancing: Podcast
- RPP Episode 29: Resolving Package Dependencies With the New Version of Pip
- Sign-up for pip UX Studies!