[Python-Dev] PEP 567 (contextvars) idea: really implement the current context (original) (raw)

Victor Stinner victor.stinner at gmail.com
Wed Jan 3 21:45:46 EST 2018


2018-01-04 3:15 GMT+01:00 Nathaniel Smith <njs at pobox.com>:

The problem with such an API is that it doesn't work (or at the very least creates a lot of complications) in a potential future PEP 550 world, (...)

Hum, it's annoying that many design choices of the PEP 567 are motivated by the hypothetical acceptance of the PEP 550, whereas this PEP is not scheduled for Python 3.7. What if the PEP 550 is rejected because it's too complicated? We might have a nicer PEP 567 API without the big shadow of the PEP 550.

Is it possible to run a generator in a context explicitly using PEP 567 Context.run() API?

--

I never looked seriously at the PEP 550, because I'm scared by its length and its complexity :-)

While I easily see use cases for asyncio web frameworks with the PEP 567, it's harder for me to see the use cases of the PEP 550.

I never had to keep a context in a generator. I guess that developers who have to do that learnt how to workaround this Python limitation, maybe passing manually the context to the generator and reapply it at each step?

Victor



More information about the Python-Dev mailing list