7 Sep
2017
7 Sep
'17
4:52 p.m.
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