Yury Selivanov wrote:
The PEP gives you a Task Local Storage, where Task is:
1. your single-threaded code
2. a generator
3. an async task
If you correctly use context managers, PEP 550 works intuitively and
similar to how one would think that threading.local() should work.
My version works *more* similarly to thread-local storage,
IMO.
Currently, if you change the decimal context without using
a with-statement or something equivalent, you *don't*
expect the change to be confined to the current function
or sub-generator or async sub-task.
All I'm asking for is one consistent rule: If you want
a context change encapsulated, use a with-statement. If
you don't, don't.
Not only is this rule simpler than yours, it's the
*same* rule that we have now, so there is less for
users to learn.
--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com