On Wed, Jan 3, 2018 at 3:04 AM Victor Stinner <victor.stinner at gmail.com> wrote: > What is the behaviour of ContextVar.reset(token) if the token was created > from a different variable? Raise an exception? > > token = var1.set("value") > var2.reset(token) > > The PEP states that Token.var only exists for debug or introspection. > It will raise an error. I'll specify this in the PEP. Yury > Victor > > > Le 3 janv. 2018 00:51, "Victor Stinner" <victor.stinner at gmail.com> a > écrit : > > Why ContextVar.reset(token) does nothing at the second call with the same > token? What is the purpose of Token._used? I guess that there is an use > case to justify this behaviour. > > reset() should have a result: true if the variable was restored to its > previous state, false if reset() did nothing because the token was already > used. And/Or Token should have a read-only "used" property. > > Victor > > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/yselivanov.ml%40gmail.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180103/5991b758/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4