Re: [Python-Dev] PEP 567 v2

2018年1月05日 08:32:16 -0800

On Fri, Jan 5, 2018 at 2:05 AM, Victor Stinner <[email protected]>
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)
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to