[Python-Dev] PEP 550 v4 (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Sep 7 03:46:16 EDT 2017


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



More information about the Python-Dev mailing list