<div dir="ltr"><span class="gmail-im">2017-11-29 11:14 GMT+03:00 Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span>:<br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">It's OK to say "the use case exists, but I still<br>
don't want that particular syntax for it in Python" (I'm personally<br>
inclined to agree with you on that front). It's not OK to try to claim<br>
there are no use cases where the status quo is awkward enough to<br>
become irritating (since it's an empirically false statement that you<br>
don't need to be making).<br></blockquote><div><br></div></span><div>If the problem with the proposed syntax, <span id="gmail-m_3058274608923277986gmail-result_box" class="gmail-m_3058274608923277986gmail-" lang="en"><span class="gmail-m_3058274608923277986gmail-">but there are cases for use, it may be worth to bikeshed one more time?</span></span><span id="gmail-m_3058274608923277986gmail-result_box" class="gmail-m_3058274608923277986gmail-" lang="en"><span class="gmail-m_3058274608923277986gmail-"><span class="gmail-m_3058274608923277986gmail-st"><br></span></span></span></div><div><span id="gmail-m_3058274608923277986gmail-result_box" class="gmail-m_3058274608923277986gmail-" lang="en"><span class="gmail-m_3058274608923277986gmail-"><span class="gmail-m_3058274608923277986gmail-st"><br></span></span></span></div><span class="gmail-im">2017-11-29 9:08 GMT+03:00 Steven D'Aprano <span dir="ltr"><<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>></span>:<br>
<br></span><span class="gmail-im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I'd much prefer to read, write and teach the version with ?? over the<br>
status quo.<span class="gmail-m_3058274608923277986gmail-HOEnZb"></span></blockquote><div><br></div></span><div><span id="gmail-m_3058274608923277986gmail-result_box" class="gmail-m_3058274608923277986gmail-" lang="en"><span class="gmail-m_3058274608923277986gmail-">Since the proposed semantics is more similar to the idea of "or", may be it is better to consider something like:</span></span></div><div><span id="gmail-m_3058274608923277986gmail-result_box" class="gmail-m_3058274608923277986gmail-" lang="en"><span class="gmail-m_3058274608923277986gmail-"><br></span></span></div><div>timeout then local_timeout then global_timeout</div><div><br></div><div><span id="gmail-m_3058274608923277986gmail-result_box" class="gmail-m_3058274608923277986gmail-" lang="en"><span class="gmail-m_3058274608923277986gmail-">I do not know how much this is a frequent case to be worthy of a keyword.</span></span></div><div><span id="gmail-m_3058274608923277986gmail-result_box" class="gmail-m_3058274608923277986gmail-" lang="en"><span class="gmail-m_3058274608923277986gmail-"><br></span></span></div><span id="gmail-m_3058274608923277986gmail-result_box" class="gmail-m_3058274608923277986gmail-" lang="en"><span class="gmail-m_3058274608923277986gmail-">With kind regards, -gdg</span></span></div><div class="gmail_extra"><br><div class="gmail_quote">2017-11-29 11:14 GMT+03:00 Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 29 November 2017 at 16:13, David Mertz <<a href="mailto:mertz@gnosis.cx">mertz@gnosis.cx</a>> wrote:<br>
> Strong -1 still from me. Too special case for syntax. Just write a function<br>
> 'first_non_none()' that can perfectly will handle the need.<br>
<br>
</span>That's the equivalent of SQL's COALESCE, and it's insufficient for the<br>
same reason "and" and "or" are syntax rather than builtins: the<br>
function form doesn't provide short-circuiting behaviour.<br>
<br>
As far as utility goes, I put it in a similar category to matrix<br>
multiplication: if you don't need it, you don't need it, but when you<br>
do need it, you need it a *lot*.<br>
<br>
The use case where these operations come up is when you're working<br>
with partially structured hierarchical data (*cough*JSON*cough*). In<br>
those kinds of structures, None is frequently used as a marker to say<br>
"this entire subtree is missing", and you either want to propagate<br>
that None, or else replace it with something else (and the "something<br>
else" may be a network call to a different service, so you definitely<br>
don't want to do it if you don't need to).<br>
<br>
So I'd remind folks to try to avoid the "I don't need this, so nobody<br>
needs this" mistake. It's OK to say "the use case exists, but I still<br>
don't want that particular syntax for it in Python" (I'm personally<br>
inclined to agree with you on that front). It's not OK to try to claim<br>
there are no use cases where the status quo is awkward enough to<br>
become irritating (since it's an empirically false statement that you<br>
don't need to be making).<br>
<br>
Cheers,<br>
Nick.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Nick Coghlan | <a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a> | Brisbane, Australia<br>
</font></span><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
</div></div></blockquote></div><br></div>