Hi!,

> Core concept
> ''''''''''''
>
> A context-local variable is represented by a single instance of
> ``contextvars.Var``, say ``cvar``. Any code that has access to the
``cvar``
> object can ask for its value with respect to the current context. In the
> high-level API, this value is given by the ``cvar.value`` property::
>
>     cvar = contextvars.Var(default="the default value",
>                            description="example context variable")
>
>     assert cvar.value == "the default value"  # default still applies
>
>     # In code examples, all ``assert`` statements should
>     # succeed according to the proposed semantics.

[...]

> Running code in a clean state
> '''''''''''''''''''''''''''''
>
> Although it is possible to revert all applied context changes
> using the above primitives, a more convenient way to run a block
> of code in a clean context is provided::
>
>     with context_vars.clean_context():
>         # here, all context vars start off with their default values
>     # here, the state is back to what it was before the with block.

why not to call the section 'Running code in the default state' and the
method just `.default_context()`:

with context_vars.default_context():
        # here, all context vars start off with their default values
# here, the state is back to what it was before the with block.

Means `clean` here `default` (the variable is constructed as
cvar = ontextvars.Var(default="the default value", ...) ?

Thanks in advance,
--francis

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to