[Python-Dev] PEP 550 v3 naming

Nick Coghlan ncoghlan at gmail.com
Thu Aug 24 04:22:55 EDT 2017


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.

As a user of the read/write API though, you shouldn't need to care all
that much - the whole point of PEP 550 is to define default behaviours
and guidelines such that it will be something sensible.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list