[Python-Dev] PEP 550 v4
yselivanov.ml at gmail.com
Thu Sep 7 03:10:14 EDT 2017
On Wed, Sep 6, 2017 at 11:55 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>> Yeah, so my claim this is simply a non-problem, and you've pretty much
>> just proved that by failing to come up with pointers to actual code that
>> would suffer from this. Clearly you're not aware of any such code.
> In response I'd ask Yuri to come up with examples of real
> code that would benefit significantly from being able to
> make context changes without wrapping them in a with
A real-code example: make it possible to implement
decimal.setcontext() on top of PEP 550 semantics.
I still feel that there's some huge misunderstanding in the
discussion: PEP 550 does not promote "not using context managers". It
simply implements a low-level mechanism to make it possible to
implement context managers for generators/coroutines/etc. Whether
this API is used to write context managers or not is completely
irrelevant to the discussion.
How does threading.local() promote or demote using of context
managers? The answer: it doesn't. Same answer is for PEP 550, which
is a similar mechanism.
More information about the Python-Dev