<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Sep 18, 2015 at 11:21 PM, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span class=""><div class="gmail_extra"><div class="gmail_quote">On Fri, Sep 18, 2015 at 8:41 PM, Steven D'Aprano <span dir="ltr"><<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
It's a funny thing, I'm usually not a huge fan of symbols outside of<br>
maths operators, and I strongly dislike the C ? ternary operator, but<br>
this one feels really natural to me. I didn't have even the most<br>
momentary "if you want Perl, you know where to find it" thought.<span></span><br></blockquote></div><br></div></span><div class="gmail_extra">I do, but at least the '?' is part of an operator, not part of the name (as it is in Ruby?).<br><br></div><div class="gmail_extra">I really, really, really don't like how it looks, but here's one thing: the discussion can be cut short and focus almost entirely on whether this is worth making Python uglier (and whether it's even ugly :-). The semantics are crystal clear and it's obvious that the way it should work is by making "?.", ?(" and "?[" new operators or operator pairs -- the "?" should not be a unary postfix operator but a symbol that combines with certain other symbols.</div></div></blockquote></div><div class="gmail_extra"><br></div>I really liked this whole thread, and I largely still do -- I?think -- but I'm not sure I like how `?` suddenly prevents whole blocks of code from being evaluated. Anything within the (...) or [...] is now skipped (IIUC) just because a `?` was added, which seems like it could have side effects on the surrounding state, especially since I expect people will use it for squashing/silencing or as a convenient trick after the fact, possibly in code they did not originally write.</div><div class="gmail_extra"><br></div><div class="gmail_extra">If the original example included a `?` like so:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div style="font-size:12.8px">    response = json.dumps?({</div><div style="font-size:12.8px">        'created': created?.isoformat(),<br></div><div style="font-size:12.8px">        'updated': updated?.isoformat(),</div><div style="font-size:12.8px">        ...</div><div style="font-size:12.8px">    })</div></div><div class="gmail_extra"><br></div><div class="gmail_extra">should "dumps" be None, the additional `?` (although though you can barely see it) prevents *everything else* from executing. This may cause confusion about what is being executed, and when, especially once nesting (to any degree really) and/or chaining comes into play!</div><div class="gmail_extra"><br></div><div class="gmail_extra">Usually when I want to use this pattern, I find I just need to write things out more. The concept itself vaguely reminds me of PHP's use of `@` for squashing errors. In my opinion, it has some utility but has too much potential impact on program flow without being very noticeable. If I saw more than 1 per line, or a couple within a few lines, I think my ability to quickly identify -> analyze -> comprehend possible routes in program control flow decreases. I feel like I'll fault more, double back, and/or make sure I forevermore look harder for sneaky `?`s.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I probably need to research more examples of how such a thing is used in real code, today. This will help me get a feel for how people might want to integrate the new `?` capability into their libraries and apis, maybe that will ease my readability reservations.<br clear="all"><div><br></div><div>Thanks,</div><div><br></div>-- <br><div class="gmail_signature"><br>C Anthony</div>
</div></div>