pep-567: Add another reason why Contexts are not mutable (#623)

This commit is contained in:
Yury Selivanov 2018-04-18 14:20:36 -04:00 committed by GitHub
parent d3a5143cbc
commit a58594429e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -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
-------------------------------------