[Async-sig] New blog post: Notes on structured concurrency, or: Go statement considered harmful

Antoine Pitrou solipsis at pitrou.net
Wed Apr 25 06:17:25 EDT 2018

On Wed, 25 Apr 2018 02:24:15 -0700
Nathaniel Smith <njs at pobox.com> wrote:
> Hi all,
> I just posted another essay on concurrent API design:
> https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/
> This is the one that finally gets at the core reasons why Trio exists;
> I've been trying to figure out how to write it for at least a year
> now. I hope you like it.

My experience is indeed that something like the nursery construct would
make concurrent programming much more robust in complex cases.
This is a great explanation why.

API note: I would expect to be able to use it this way:

class MyEndpoint:

    def __init__(self):
        self._nursery = open_nursery()

    # Lots of behaviour methods that can put new tasks in the nursery

    def close(self):

Also perhaps more finegrained shutdown routines such as:

* Nursery.join(cancel_after=None):

  wait for all tasks to join, cancel the remaining ones
  after the given timeout



More information about the Async-sig mailing list