Async Techniques and Examples in Python Transcripts
Chapter: Built on asyncio
Lecture: Demo: Starter code for Trio app

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Our goal with Trio here is to take something we've already done and make it simpler and actually make it do even more without any complications at all.
0:11 You guys remember the producer-consumer, here we are again. It's a simple application and there's a really nice example I can show you here with Trio.
0:19 So, here's the synchronous version, we've seen that. We've taken the synchronous version and we've upgraded it to use asynch I/O.
0:26 So, we get the event loop. We create all the tasks. We turn them into a single task. We wait for them to run. This is okay.
0:33 One of the things we didn't really talk about is cancellation. What if we're going to say, run this and if the user chooses to cancel,
0:40 or we're willing to wait, say up to five seconds but not longer, then we're going to bail and cancel all the tasks and things like that.
0:46 So, we'll see that with Trio this more advanced scenario becomes super easy. But our first job is we're going to take this app
0:53 and we're going to convert it to use Trio, and a little bit like unsync, you're going to see that some of the challenges
0:59 and ugly hoops you have to jump through just go away.

Talk Python's Mastodon Michael Kennedy's Mastodon