PyDocs

Nav

Concurrent Execution

ContextVar.set

  • ContextVar.set(value)
Call to set a new value for the context variable in the current context.

The required value argument is the new value for the context
variable.

Returns a Token object that can be used to restore the variable to
its previous value via the `ContextVar.reset()` method.
Changed in 3.14
  • 3.14: Added support for using tokens as context managers.
0 Examples
No examples for contextvars/ContextVar.set.
See Also
No see-alsos for contextvars/ContextVar.set
0 Notes
No notes for ContextVar.set