[Python-Dev] PEP 567 v3

Guido van Rossum guido at python.org
Tue Jan 16 18:53:10 EST 2018


On Tue, Jan 16, 2018 at 3:26 PM, Victor Stinner <victor.stinner at gmail.com>
wrote:

> Thanks for the updated PEP v3, it's now much better than PEP v2!
>
> I have no more complain against your PEP. I vote +1 for PEP 567
> contextvars!
>

Yeah!

> The only open question I personally have is whether ContextVar.reset()
> > should be idempotent or not.  Maybe we should be strict and raise an
> > error if a user tries to reset a variable more than once with the same
> > token object?
>
> I don't think that it's worth it to prevent misuage of reset(). IMHO
> it's fine if calling reset() twice reverts the variable state twice.
>

Maybe the effect of calling it twice should be specified as undefined --
the implementation can try to raise in simple cases.

Unless Yury has a use case for the idempotency? (But with
__enter__/__exit__ as the main use case for reset() I wouldn't know what
the use case for idempotency would be.)

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180116/80e9b7d4/attachment-0001.html>


More information about the Python-Dev mailing list