[Python-ideas] New PEP 550: Execution Context
Yury Selivanov
yselivanov.ml at gmail.com
Sat Aug 12 01:41:06 EDT 2017
[replying to the list]
> I may have missed this (I've just skimmed the doc), but what's the rationale for making the EC an *immutable* mapping?
It's possible to implement Execution Context with a mutable mapping
and copy-on-write (as it's done in .NET) This is one of the approaches
that I tried and I discovered that it causes a bunch of subtle
inconsistencies in contexts for generators and coroutines. I've tried
to cover this here:
https://www.python.org/dev/peps/pep-0550/#copy-on-write-execution-context
All in all, I believe that the immutable mapping approach gives the
most predictable and easy to reason about model. If its performance on
large number of items in EC is a concern, I'll be happy to implement
it using HAMT (also covered in the PEP).
Yury
More information about the Python-ideas
mailing list