Funny parallel with Python
Funny parallel with Python
Posted Sep 25, 2025 9:23 UTC (Thu) by kleptog (subscriber, #1183)Parent article: Canceling asynchronous Rust
> In those languages, creating the equivalent of a Future (called a promise) starts executing the code right away in a separate thread, and the promise is just a handle for retrieving the eventual result.
We ran into something similar when migrating old Tornado code to the new asyncio library in Python. When Python did async code via generators/coroutines, the semantics of yield are that generators are run until the first yield. Whereas async methods don't run at all until polled, like Rust. This almost never matters, but it turned out there were a handful of places that expected some of the side-effects to happen straight away, and they broke.
