[Python-Dev] PEP 550 v3 naming
Nathaniel Smith
njs at pobox.com
Thu Aug 24 05:01:18 EDT 2017
On Thu, Aug 24, 2017 at 1:22 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 24 August 2017 at 02:19, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
>> I think that "implicit context" is not an accurate description of what
>> LogicalContext is.
>>
>> "implicit context" only makes sense when we talk about decimal
>> context. For instance, in:
>>
>> Decimal(1) + Decimal(2)
>>
>> decimal context is implicit. But this is "implicit" from the
>> standpoint of that code. Decimal will manage its context
>> *explicitly*.
>>
>> Fixing decimal context is only one part of the PEP though. EC will
>> also allow to implement asynchronous task locals:
>>
>> current_request = new_context_key()
>>
>> async def handle_http_request(request):
>> current_request.set(request)
>>
>> Here we explicitly set and will explicitly get values from the EC. We
>> will explicitly manage the EC in asyncio.Task and when we schedule
>> callbacks.
>
> The implicit behaviour that "implicit context" refers to is the fact
> that if you look at an isolated snippet of code, you have no idea what
> context you're actually going to be querying or modifying - that's
> implicit in the execution of the whole program.
How about: RuntimeContext and RuntimeContextStack
-n
--
Nathaniel J. Smith -- https://vorpus.org
More information about the Python-Dev
mailing list