[Python-Dev] PEP 550 v4

Yury Selivanov yselivanov.ml at gmail.com
Wed Sep 6 20:17:40 EDT 2017

On Wed, Sep 6, 2017 at 5:06 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Nathaniel Smith wrote:
>> The implementation strategy changed radically between v1
>> and v2 because of considerations around generator (not coroutine)
>> semantics. I'm not sure what more it can do to dispel these feelings
>> :-).
> I can't say the changes have dispelled any feelings on my part.
> The implementation suggested in the PEP seems very complicated
> and messy. There are garbage collection issues, which it
> proposes using weak references to mitigate.

"messy" and "complicated" doesn't sound like a valuable feedback :(

There are no "garbage collection issues", sorry.  The issue that we
use weak references for is the same issue why threading.local() uses

    def foo():
         var = ContextVar()

    for _ in range(10**6): foo()

If 'var' is strongly referenced, we would have a bunch of them.

> There is also
> apparently some issue with long chains building up and
> having to be periodically collapsed. None of this inspires
> confidence that we have the basic design right.
> My approach wouldn't have any of those problems. The
> implementation would be a lot simpler.



More information about the Python-Dev mailing list