Loading video player…

Exploring Asynchronous Iterators and Iterables (Overview)

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 control async for loops, while asynchronous iterables are objects that you can iterate over using async for loops.

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 what async iterators and iterables are in Python
  • Create async generator expressions and generator iterators
  • Code async iterators and iterables with the .__aiter__() and .__anext__() methods
  • Use async iterators in async loops and comprehensions
Download

Course Slides (.pdf)

2.9 MB
Download

Sample Code (.zip)

2.6 KB

00:00 Hey, and welcome to this course where you and I will be exploring asynchronous iterators and interables. Once you are familiar with the basics of the Python programming language and you have proudly started writing code that actually works, you might start thinking about making that code work more effectively.

00:21 And with that, I mean use the CPU more effectively. So you might have read up a bit on async programming, and given that you are interested in this course, I’m kind of going to assume that you have.

00:33 And you might realize that async programming without loops or without iteration doesn’t get you very far. So that is what you and I will be fixing in this course.

00:45 Ideally, you will have heard of async programming before, so this course could be considered your next step on your async programming journey. Having said that, though, there is a quick recap of the async basics at the start of the course.

01:02 Now, you will also benefit from some basic knowledge when it comes to classes, attributes, and methods. And lastly, it’s also best if you don’t mind a little bit of silliness when it comes to the example that you’ll be working on.

01:15 Why not have a little bit of fun during our time together?

01:20 So in this course, you’ll learn what async iterators and interables are, how concurrency is achieved using async, iterators and interables, and then how async iterators and interables are implemented.

01:35 Now, more specifically, you’ll start with a basic async programming example, so one that does not include iteration. Then secondly, there’s the introduction to our async iterators and interables, and then thirdly, there are examples.

01:52 So that’s what’s on offer. My name is Steven Loyens, and I will be your instructor for this course. See you in the first lesson.

Become a Member to join the conversation.