[Python-ideas] PEP draft: context variables

Yury Selivanov yselivanov.ml at gmail.com
Thu Oct 12 14:02:58 EDT 2017


On Thu, Oct 12, 2017 at 8:59 AM, Koos Zevenhoven <k7hoven at gmail.com> wrote:
> On Thu, Oct 12, 2017 at 6:54 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
[..]
>> 1. Preserve the current behaviour, since we don't have a compelling reason
>> to change its semantics
>> 2. Change the behaviour, in order to gain <end user benefit>
>>
>
> 3. Introduce a new context manager that behaves intuitively. My guess is
> that the two context managers could even be made to interact with each other
> in a fairly reasonable manner, even if you nest them in different orders.
> I'm not sure how necessary that is.

Note that this is an independent argument w.r.t. both PEPs.  PEP 550
does not propose to change existing decimal APIs.  It merely uses
decimal to illustrate the problem, and suggests a fix using the new
APIs.

Although it is true that I plan to propose to use PEP 550 to
reimplement decimal APIs on top of it, and so far I haven't seen any
real-world examples of code that will be broken because of that.  As
far as I know—and I've done some research—nobody uses decimal contexts
and generators because of the associated problems.  It's a chicken and
egg problem.

Yury


More information about the Python-ideas mailing list