Generators and Generator Expressions
Learning Path ⋅ Skills: Python, Iterators, Iterables, Itertools, Asynchronous Iterations, Generators, Yield
Learn how Python’s iterator protocol, generators, and the itertools module work together. You’ll write generator functions with yield, build pipelines using generator expressions, and apply these patterns to asynchronous iteration.
Generators and Generator Expressions
Learning Path ⋅ 4 Resources
Iterators and Iterables
Start by understanding the iterator protocol that underpins all iteration in Python. You’ll learn the difference between iterators and iterables and how to create your own.
Course
Efficient Iterations With Python Iterators and Iterables
Learn what iterators and iterables are in Python. You'll learn how they differ and when to use them in your code. You'll also learn how to create your own iterators and iterables to make data processing more efficient.
Interactive Quiz
Iterators and Iterables in Python: Run Efficient Iterations
Working With itertools
Python’s itertools module provides a collection of fast, memory-efficient tools for working with iterators. Explore how to use these building blocks to handle complex iteration tasks.
Tutorial
Python itertools By Example
Master Python's itertools module by constructing practical examples. You'll start out simple and then gradually tackle more complex challenges, encouraging you to "think iteratively."
Generators and the yield Keyword
Generators let you produce values lazily, one at a time, without building entire sequences in memory. Learn how to write generator functions using yield and how to use generator expressions.
Course
Python Generators 101
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.
Interactive Quiz
How to Use Generators and yield in Python
Asynchronous Iteration
Apply what you’ve learned about iterators and generators to asynchronous programming. You’ll see how to create and use async iterators, async generators, and async comprehensions.
Course
Exploring Asynchronous Iterators and Iterables
Learn to build async iterators and iterables in Python to handle async operations efficiently and write cleaner, faster code.
Interactive Quiz
Asynchronous Iterators and Iterables in Python
Congratulations on completing this learning path! You now have a solid understanding of Python’s iteration tools, from iterators and iterables through generators and asynchronous iteration.
Continue your intermediate Python journey with the next learning path:
Learning Path
Write More Pythonic Code
14 Resources ⋅ Skills: Zen of Python, PEP 8, Application Layouts, Duck Typing, Type Checking, Type Hints, Code Documentation, MkDocs, Code Quality, PyLint
You might also be interested in these related learning paths:
Got feedback on this learning path?
Looking for real-time conversation? Visit the Real Python Community Chat or join the next “Office Hours” Live Q&A Session. Happy Pythoning!
