Virtual threads could provide a simpler alternative to async/await in Python by combining the ergonomics of blocking APIs with the performance benefits of concurrent execution. The approach would use structured concurrency through thread groups, eliminating the need for colored functions while moving complexity into the runtime. This model would allow developers to write sequential-looking code that runs concurrently, with automatic thread scheduling and cancellation handling built into the interpreter.

10m read timeFrom lucumr.pocoo.org
Post cover image
Table of contents
How We Got HereStructured, Virtual ThreadsOnly ThreadsThe Better APIAPI CompromisesComplexity Goes Where It BelongsFuturesSpawn Without Thread GroupsFuture of Async Await?

Sort: