[Python-Dev] PEP 567 v2

Guido van Rossum guido at python.org
Fri Jan 5 11:48:07 EST 2018


On Fri, Jan 5, 2018 at 3:10 AM, Paul Moore <p.f.moore at gmail.com> wrote:

> On 5 January 2018 at 11:06, Victor Stinner <victor.stinner at gmail.com>
> wrote:
> >> Le 5 janv. 2018 11:42 AM, "Paul Moore" <p.f.moore at gmail.com> a écrit :
> >> """
> >> A Context is a mapping from ContextVar objects to their values. The
> >> Context itself exposes the Mapping interface, so cannot be modified
> >> directly - to modify the value associated with a variable you need to
> >> use the ContextVar.set() method.
> >> """
> >>
> >> Does that explain things correctly? One thing I am sure of is that we
> >> should remove "implemented using an immutable dictionary" - it's an
> >> implementation detail, and adds nothing but confusion to mention it
> >> here.
>
> > You can only modify a context when it's the current context, so using
> > ContextVar.set() in Context.run().
>
> Thanks. That's a useful qualification. But it may be too detailed for
> the summary - it's certainly something that should be covered in the
> specification section, though. Maybe "...  you need to use the
> ContextVar.set() method from Context.run()" would be OK, although I
> don't want the summary to get too long.
>

(Sorry, I wrote my previous response before seeing this part of the
exchange.)

Maybe "... you need to use the ContextVar.set() method, which modifies the
current context."

Then we also need to update the summary for ContextVar.set(), which
currently IMO is plain wrong.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180105/63e31c1d/attachment.html>


More information about the Python-Dev mailing list