[Python-Dev] PEP 550 v3 naming

Ethan Furman ethan at stoneleaf.us
Wed Aug 23 18:47:44 EDT 2017


On 08/23/2017 12:17 PM, Yury Selivanov wrote:
>> How about ExecutionContext and ContextVars ?
>
>> We are already used to different levels of variables: global, local, non-local, class.  I think having variables tied to a Context, and having search flow back to previous Contexts, would be easy to understand.
>
> Yeah, I had this idea about ContextVars and so far I like it more than
> Context Keys and Context Values.
>
> In the next version of the PEP (will post it soon), we use Execution
> Context, Logical Context, and Context Variable terminology (the debate
> if we should use other names is, of course, still open).

ContextVars is actually a different name for LogicalContext.  So it would be:

   ExecutionContext = [ContextVars()[, ContextVars()[ ...]]]

and you get the (thread.local similar) ContextVars by

   context_vars = sys.get_context_vars()   # or whatever
   context_vars.verbose = ...

--
~Ethan~


More information about the Python-Dev mailing list