From a58594429e766dd2532dfb40828e7517194184da Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Wed, 18 Apr 2018 14:20:36 -0400 Subject: [PATCH] pep-567: Add another reason why Contexts are not mutable (#623) --- pep-0567.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pep-0567.rst b/pep-0567.rst index cbc6920d3..3f5f3fffb 100644 --- a/pep-0567.rst +++ b/pep-0567.rst @@ -712,6 +712,15 @@ This proposal was deferred to Python 3.8+ because of the following: ctx.run(func) +3. If ``Context`` was mutable it would mean that context variables + could be mutated separately (or concurrently) from the code that + runs within the context. That would be similar to obtaining a + reference to a running Python frame object and modifying its + ``f_locals`` from another OS thread. Having one single way to + assign values to context variables makes contexts conceptually + simpler and more predictable, while keeping the door open for + future performance optimizations. + Having initial values for ContextVars -------------------------------------