On Sat, Aug 12, 2017 at 10:56 PM, Nick Coghlan <ncogh...@gmail.com> wrote:
[..]
> As Nathaniel suggestion, getting/setting/deleting individual items in
> the current context would be implemented as methods on the ContextItem
> objects, allowing the return value of "get_context_items" to be a
> plain dictionary, rather than a special type that directly supported
> updates to the underlying context.

The current PEP 550 design returns a "snapshot" of the current EC with
sys.get_execution_context().

I.e. if you do

ec = sys.get_execution_context()
ec['a'] = 'b'

# sys.get_execution_context_item('a') will return None

You did get a snapshot and you modified it -- but your modifications
are not visible anywhere. You can run a function in that modified EC
with `ec.run(function)` and that function will see that new 'a' key,
but that's it. There's no "magical" updates to the underlying context.

Yury
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to