1. 9
  1.  

  2. 2

    I skimmed through this, and it looked kind of like Go’s context? Is that the tl;dr? I’ve been out of the loop for Python 3, so I have a lot less context on the shift to async and coroutines, but as someone who writes Go, and used to love writing and using generators for random things in Python 2, I can see how this could be useful, and very interesting!

    1. 2

      You can read in the rationale:

      Some languages that have coroutines or generators recommend to manually pass a context object to every function, see [1] describing the pattern for Go. This approach, however, has limited use for Python, where we have a huge ecosystem that was built to work with a TLS-like context. Moreover, passing the context explicitly does not work at all for libraries like decimal or numpy, which use operator overloading.

      1. 2

        Oh interesting. I’m going to upgrade to “reading” rather than skimming. Thanks for the inspiration!

      2. 2

        To me it sounded more like putting something like xlocal, which I’ve used and liked for this purpose in the past, in the standard library.