Skip to content
0:00 / 0:00

#asyncio#generators#coroutines

Build Your Own Async

David Beazley

17K subscribers • 4 videos on Hallway

YouTube
  • Recommended by 4 people: 4 on Hacker News.
  • A classic. People kept recommending it from 2020 to 2023.
  • Presented by David Beazley, author and Python developer

Advanced. Deep dive for people who know the field.

59K views7 years ago4 recommendations

Programming languagesSystems programmingPythonConcurrency and parallelism

David Beazley builds an asynchronous concurrency framework from scratch in Python using callbacks, generators, and coroutines.

Screencast based on a workshop originally presented at PyCon India, Chennai, October 14, 2019. Code samples at: gist.github.com/dabeaz/f86ded8d61206c757c5cd4dbb5109f74 This workshop is about the low-level foundations and abstractions for asynchronous programming in Python. It's a bit unusual in that rather than starting with traditional topics such as non-blocking I/O or sockets, it instead focuses on the core problem of implementing concurrency in lieu of threads. The first part illustrates the process of providing concurrency with callback functions and continuations. The second part, illustrates concurrency using generators and coroutines. At the end, I show how both callback-based and coroutine-based concurrency can be made to co-exist in the same program. The workshop does not focus on the specific implementation details of any one async library (i.e., asyncio, curio, etc.). Instead it is about core concepts. A goal of the workshop is to make it easier to understand the implementation of async libraries and their associated complexities. If you liked this you might enjoy one of my courses. dabeaz.com/courses.html

Why it's here

4 people recommend this

What people say. Highly recommended for its deep, bottom-up explanation of how asynchronous runtimes and event loops work under the hood.

devxpyon Hacker News • Recommends

On “Linux containers in a few lines of code”

Yes, something like that. Like here's David's "Build Your Own Async" 1, which I prefer over Philip's (still extremely good) "What the heck is the event loop anyway?" 2. It's one thing to tell how something works, but to successfully show what the hell its actually doing under the covers, just conveys much more information. 1 link to this video 2 link

miguelolleron Hacker News • Recommends

On “Guide to Concurrency in Python with Asyncio”

I've found this 1 screencast on the low-level principles of async in Python an amazing resource to understand async at a deep level. 1 link to this video

neoncontrailson Hacker News • Recommends

On “Pre-Allocated Lists in Python”

…C code), but still incredibly enlightening dive into the "dark side" of Python, in particular various abuses and hexes for manipulating control flow, have a look at David Beazley's smorgasboard of keynote presentations like "Generators: The Final Frontier" ( link ), "Python Concurrency From The Ground Up" ( link ), and "Build Your Own Async" ( link to this video ).…

mananaysiempreon Hacker News • Recommends

On “Philosophy of Coroutines”

…ng an async runtime (to put it pompously) and you can see how the whole thing hangs together. It’s really quite simple, and in my experience it’s much better than trying to wrap your head around the asyncio docs, because while the language-level foundations are extremely nice and simple, asyncio the stdlib module just kind of sucks. 1 link 2 link to this video…

u/henry232323in r/ProgrammingLanguages • Mentions

On “Just implemented generators - is this enough to get async working?”

It's totally enough. Python's first official async implementation was all generators before it was given official syntax. There's a couple talks on implementing async with generators from within the language. link to this video