<div dir="ltr">[Chris Angelico]<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I have to defer to someone who knows in more detail here, but the<br></span><span style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">parser will look ahead one "token", whatever a token is. (Technically<br></span><span style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">it doesn't backtrack, it looks ahead - same difference.) In order for<br></span><span style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">the ternary-if to work, the expression before the if has to be of a<br></span><span style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">more restricted type than just "any expression" (for instance, you<br></span><span style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">can't put a lambda function there, unless you parenthesize it).</span></blockquote><div><br></div><div>Interesting. I really need to try delving into the nuts and bolts of Python.<br>I didn't know that about ternary expressions.<br><br>I don't know if you saw my recent discussion with Jonathan Fine, but he brought up some good points too.<br></div></div>