<div dir="auto">Hum, now I'm confused. I was probably confused by ContextVar.get() differences with Context.get().<div dir="auto"><br></div><div dir="auto">It's fine if it behaves with a dict.</div><div dir="auto"><br></div><div dir="auto">Victor</div></div><div class="gmail_extra"><br><div class="gmail_quote">Le 9 janv. 2018 12:02 AM, "Nathaniel Smith" <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> a écrit :<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Jan 8, 2018 at 2:35 PM, Victor Stinner <<a href="mailto:victor.stinner@gmail.com">victor.stinner@gmail.com</a>> wrote:<br>
> ctx[var] raises an exception but ctx.get(var) returns None in such case. My<br>
> point is just that Context.get() behaves differently than dict.get(). If<br>
> dict[key] raises, I expect that dict.get() raises too and that I have to<br>
> write explicitely dict.get(default=None).<br>
<br>
But that's not how dict.get works?<br>
<br>
In [1]: d = {}<br>
<br>
In [2]: print(d.get(1))<br>
None<br>
<br>
-n<br>
<br>
--<br>
Nathaniel J. Smith -- <a href="https://vorpus.org" rel="noreferrer" target="_blank">https://vorpus.org</a><br>
</blockquote></div></div>