Image

Real Python: Exploring Asynchronous Iterators and Iterables

When you write asynchronous code in Python, you’ll likely need to create asynchronous iterators and iterables at some point. Asynchronous iterators are what Python uses to controlasync forloops, while asynchronous iterables are objects that you can iterate over usingasync forloops.

Both tools allow you to iterate over awaitable objects without blocking your code. This way, you can perform different tasks asynchronously.

In this video course, you’ll:

  • Learn whatasync iteratorsanditerablesare in Python
  • Create asyncgenerator expressionsandgenerator iterators
  • Code async iterators and iterables with the.__aiter__()and.__anext__()methods
  • Use async iterators inasync loopsandcomprehensions

[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days.>> Click here to learn more and see examples]

https://realpython.com/courses/asynchronous-iterators-iterables/