<div dir="ltr">There are too many words here for me to follow. I'll wait a few days and then hopefully there's a new proposal that you are all in agreement with, or there are two brief alternatives that I have to choose between.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 9, 2018 at 7:41 AM, Yury Selivanov <span dir="ltr"><<a href="mailto:yselivanov.ml@gmail.com" target="_blank">yselivanov.ml@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">By default, threading.local raises an AttributeError (unless you subclass it.)  Similar to that and to NameErrors, I think it's a good idea for ContextVars to raise a LookupError if a variable was not explicitly set.</div><span class="HOEnZb"><font color="#888888"><div dir="auto"><br></div><div dir="auto">Yury</div></font></span><div class="HOEnZb"><div class="h5"><div dir="auto"><br></div><div><br><div class="gmail_quote"><div>On Tue, Jan 9, 2018 at 7:15 PM Victor Stinner <<a href="mailto:victor.stinner@gmail.com" target="_blank">victor.stinner@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2018-01-09 12:41 GMT+01:00 Yury Selivanov <<a href="mailto:yselivanov.ml@gmail.com" target="_blank">yselivanov.ml@gmail.com</a>>:<br>
> But I'd be -1 on making all ContextVars have a None default<br>
> (effectively have a "ContextVar.get(default=None)" signature. This<br>
> would be a very loose semantics in my opinion.<br>
<br>
Why do you think that it's a loose semantics? For me<br>
ContextVar/Context are similar to Python namespaces and thread local<br>
storage.<br>
<br>
To "declare" a variable in a Python namespace, you have to set it:<br>
"global x" doesn't create a variable, only "x = None".<br>
<br>
It's not possible to define a thread local variable without specifying<br>
a "default" value neither.<br>
<br>
Victor<br>
</blockquote></div></div>
</div></div><br>______________________________<wbr>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/options/python-dev/<wbr>guido%40python.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div>