[Python-Dev] PEP 567 v2 (original) (raw)

Guido van Rossum guido at python.org
Thu Jan 4 18:58:04 EST 2018


On Thu, Jan 4, 2018 at 9:27 AM, Paul Moore <p.f.moore at gmail.com> wrote:

On 4 January 2018 at 15:56, Guido van Rossum <guido at python.org> wrote: > It was getcontext() in an earlier version of PEP 567. We changed it to > copycontext() believing that that would clarify that you get a clone that > is unaffected by subsequent ContextVar.set() operations (which affect the > current context rather than the copy you just got).

Ah thanks. In which case, simply changing the emphasis to avoid the implication that Context objects are immutable (while that may be true in a technical/implementation sense, it's not really true in a design sense if ContextVar.set modifies the value of a variable in a context) is probably sufficient.

Do you have a specific proposal for a wording change? PEP 567 describes Context as "a read-only mapping, implemented using an immutable dictionary." This sounds all right to me -- "read-only" is weaker than "immutable". Maybe the implementation should not be mentioned here? (The crux here is that a given Context acts as a variable referencing an immutable dict -- but it may reference different immutable dicts at different times.)

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



More information about the Python-Dev mailing list