pep-567: Add another reason why Contexts are not mutable (#623)
This commit is contained in:
parent
d3a5143cbc
commit
a58594429e
|
@ -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
|
||||
-------------------------------------
|
||||
|
|
Loading…
Reference in New Issue