<div dir="ltr">Using "?" as a (pro)noun is even worse than using it as an operator/modifier.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 24, 2015 at 3:28 PM, Erik <span dir="ltr"><<a href="mailto:python@lucidity.plus.com" target="_blank">python@lucidity.plus.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 24/09/15 04:00, Nick Coghlan wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
data = data if ? is not sentinel else default()<br>
</blockquote>
<br></span>
This reads OK in a short example like this and when using word-based operators such as "is not". However, it's a bit clumsy looking when using operators spelled with punctuation:<br>
<br>
data = data if ? != None else default()<br>
data = data if foo <= ? <= bar else default()<span class=""><br>
<br>
> title = user_title if ? is not None else local_default_title if ? is not None else global_default_title<br>
<br></span>
I don't think I like the way '?' changes its target during the line in this example.<br>
<br>
For example, the equivalent of the admittedly-contrived expression:<br>
<br>
foo = bar if foo is None else baz if baz is not None else foo.frobnicate()<br>
<br>
is:<br>
<br>
foo = bar if ? is None else baz if ? is not None else foo.frobnicate()<br>
<br>
... so you still have to spell 'foo' repeatedly (and only due to the subtle switch of the '?' target, which might go away (or be added) during code maintenance or refactoring).<br>
<br>
<br>
Also, if '?' is sort of a short-cut way of referencing the LHS, then one might naively expect to be able to write this:<br>
<br>
[(x, y) for x in range(5) if ? < 3 for y in range(5) if ? > 2]<br>
<br>
Regs, E.<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div>