[Python-Dev] PEP 550 v4
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Sep 7 19:52:57 EDT 2017
Elvis Pranskevichus wrote:
> By default, generators reference an empty LogicalContext object that is
> allocated once (like the None object). We can do that because LCs are
> immutable.
Ah, I see. That wasn't clear from the implementation, where
gen.__logical_context__ = contextvars.LogicalContext()
looks like it's creating a new one.
However, there's another thing: it looks like every
time a generator is resumed/suspended, an execution
context node is created/discarded.
--
Greg
More information about the Python-Dev
mailing list