[Python-Dev] PEP 567 v2
Guido van Rossum
guido at python.org
Fri Jan 5 11:29:26 EST 2018
On Fri, Jan 5, 2018 at 2:05 AM, Victor Stinner <victor.stinner at gmail.com>
wrote:
> Currently, Context.get(var) returns None when "var in context" is false.
> That's surprising and different than var.get(), especially when var has a
> default value.
>
I don't see the problem. Context.get() is inherited from Mapping.get(); if
you want it to raise use Context.__getitem__() (i.e. ctx[var]). Lots of
classes define get() methods with various behaviors. Context.get() and
ContextVar.get() are just different -- ContextVar is not a Mapping.
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180105/972c6cef/attachment.html>
More information about the Python-Dev
mailing list