Now you know how to write asynchronous iterators and iterables in Python. Asynchronous iterators are what Python uses to control async for loops, while asynchronous iterables are objects that you can iterate over using an async for loop, the built-in anext() function, or an async comprehension.
With async iterables and iterators, you can write non-blocking loops in your asynchronous code. This way, you can perform different tasks asynchronously.
In this video course, you’ve learned how to:
- Differentiate async iterators and iterables in Python
- Create async generator expressions and generator iterators
- Write async iterators and iterables using
.__aiter__()and.__anext__() - Use async iterators in async loops and comprehensions
Resources mentioned in this lesson:
