On Wed, Jan 3, 2018 at 6:45 PM, Victor Stinner <victor.stin...@gmail.com>
wrote:

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

Yes. You execute 'ctx = copy_context()' once, and then wrap all .next()
calls in ctx.run(). This is what the PEP proposes to do for asyncio.Task --
constructing the task calls copy_context() _step() is always wrapped in a
run() call for that context.

(This was a good question because it teases out more of the semantics of
Context.run().)

-- 
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to