News for hackers. Stuff that matters.
Re:Async Cancellation by quietbritishjim on Friday November 12, 2021 @05:20AM (#29197870)
A little off topic, but there's an excellent async library for Python called Trio (based on a conceptually similar library Curio) that implements structured concurrency [1] and timeouts [2] really well. Things are obviously a bit different from the Rust world, partly because of garbage collection (i.e. references everywhere rather than the borrow checker) but even more so because of Python's liberal use of exceptions, which are a very natural way to handle cancellation (and one of Trio's innovations is the MultiError exception). But the library documentation [3] is still an interesting read even for a Rust developer interested in concurrency.

[1] Notes on structured concurrency, or: Go statement considered harmful https://vorpus.org/blog/notes-on-structured-concurrency-or-g...

[2] Timeouts and cancellation for humans https://vorpus.org/blog/timeouts-and-cancellation-for-humans...

[3] Tutorial -- Trio documenation https://trio.readthedocs.io/en/stable/tutorial.html

Re:Async Cancellation by d0mine on Friday November 12, 2021 @11:53AM (#29201472)
The syntax enabling the structured concurrency may be included in Python 3.11 https://www.python.org/dev/peps/pep-0654/