Generators and Iterators: Video Resources¶
Best Single Video¶
Python Tutorial: Generators - How to Use Them and the Benefits You Receive by Corey Schafer (~11 min) Why: Builds generators from the ground up, starting with a normal function and converting it to a generator with yield. Demonstrates memory savings with concrete before-and-after measurements. Clear, concise, and immediately practical. The go-to starting point for understanding generators.
Alternatives¶
- Generators by Socratica (~9 min). A polished, classroom-style explanation of generators with a focus on the conceptual "why." Socratica's production quality makes this feel like a lecture, which some learners prefer.
- Iterators, Iterables, and Itertools by Socratica (~12 min). Covers the iterator protocol (iter and next), what makes something iterable versus an iterator, and introduces the itertools module. A different angle that focuses on the protocol underneath generators.
Deep Dives¶
- Python Tutorial: Decorators - Dynamically Alter The Functionality Of Your Functions by Corey Schafer (30 min). Understanding closures (covered in the first half) is essential for grasping how generators maintain state between yields. This video fills in the mental model that makes generators click.
Last verified: February 2026