Trio: Async concurrency for mere mortals
summary
Claims a concrete, simpler implementation of Happy Eyeballs using Trio primitives: async/await plus nurseries and cancel scopes, events and timeouts. Replaces a callbacky Twisted routine that is roughly 120 lines with code that is shorter, easier to follow, and avoids lost background exceptions. The demo actually builds the racing/staggered connector, uses socket.getaddrinfo and concurrent attempts, cancels losers, and successfully connects (tested against debian.org). Calls out Trio.run and move_on_after style timeouts.
AI-written summary · about
chapters (15)
- 0:00Start
- 1:17Sequential code
- 1:30Concurrent code
- 2:05Basic bidirectional proxy
- 3:07getaddrinfo example
- 5:36happy eyeballs' (RFC 8305)
- 6:24Happy eyeballs in Twisted
- 10:03Trio architecture
- 11:06Preemptive concurrency
- 11:36Cooperative (async) concurrency
- 18:10The basic concurrency primitive in most libraries/languages
- 19:32with blocks work
- 19:43Exceptions don't get lost
- 20:02Timeouts are important
- 21:39Exceptions in nurseries actually use cancellation
related talks
47mTaking Asynchronous Python to the Next Level Using Trio
37mTaking Asynchronous Python to the Next Level Using Trio
26mWhy I reimplemented Trio in a game engine
15mEvent-Driven asyncio: A Case Study of Trio's API
20mIt's Critical: Concurrent programming as a sane programming model
40mBetter asynchronous code with Tornado and Python 3
33mArtisanal Async Adventures
01h 00mCoroutine Concurrency in Python 3 with asyncio
