<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 28, 2016 at 11:17 AM, Paul Moore <span dir="ltr"><<a href="mailto:p.f.moore@gmail.com" target="_blank">p.f.moore@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 28 October 2016 at 15:40, Nick Coghlan <<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>> wrote:<br>
> I also don't think the idea is sufficiently general to be worthy of<br>
> dedicated syntax if it's limited specifically to "is not None" checks<br>
> - None's definitely special, but it's not *that* special. Unifying<br>
> None, NaN, NotImplemented and Ellipsis into a meta-category of objects<br>
> that indicate the absence of information rather than a specific value,<br>
> though? <br></span></blockquote><div><br></div><div>First thing is that I definitely DO NOT want new SYNTAX to do this. I wouldn't mind having a new built-in function for this purpose if we could get the call signature right. Maybe it would be called 'exists()', but actually something like 'valued()' feels like a better fit.</div><div><br></div><div>For the unusual case where the "null-coalescing" operation is what I'd want, I definitely wouldn't mind something like Barry's proposal of processing a string version of the expression. Sure, *some* code editors might not highlight it as much, but it's a corner case at most, to my mind. For that, I can type 'valued("x.y.z[w]", coalesce=ALL)' or whatever.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">However, I'm not convinced by your proposal that we can unify None, NaN,<br>
NotImplemented and Ellipsis in the way you suggest. I wouldn't expect<br>
a[1, None, 2] to mean the same as a[1, ..., 2], so why should an<br>
operator that tested for "Ellipsis or None" be useful? </blockquote><div><br></div><div>I *especially* think None and nan have very different meanings. A list of [1.1, nan, 3.3] means that I have several floating point numbers, but one came from a calculation that escaped the real domain. A list with [1.1, None, 3.3] means that I have already calculated three values, but am marking the fact I need later to perform a calculation to figure out the middle one. These are both valid and important use cases, but they are completely different from each other.</div><div><br></div><div>Yours, David...</div></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Keeping medicines from the bloodstreams of the sick; food <br>from the bellies of the hungry; books from the hands of the <br>uneducated; technology from the underdeveloped; and putting <br>advocates of freedom in prisons. Intellectual property is<br>to the 21st century what the slave trade was to the 16th.<br></div>
</div></div>