<div dir="ltr"><div class="gmail_quote"><div dir="ltr">[INADA Naoki]</div><font face="arial, helvetica, sans-serif">> ...<br></font><span style="font-family:arial,helvetica,sans-serif">> On the other hand, I understand PEP 572 allows clever code<br>> simplifies tedious c</span><span style="font-family:arial,helvetica,sans-serif">ode.  It may increase readability of non-dirty code.  </span><br><div dir="ltr"><div class="gmail_quote"><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">The latter is the entire intent ,of course.  We can't force people to write readable code, but I don't understand the widespread assumption that other programmers are our enemies who have to be preemptively disarmed ;-)</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">Use code review to enforce readable code.  If you want a coding standard here, use mine:  "if using an assignment expression isn't obviously better (at least a little so), DON'T USE IT".  That's the same standard I use for lots of things (e.g., is such-&-such better as a listcomp or as nested loops?).  It only requires that you have excellent taste in what "better" means ;-)<br><br>As I noted in the PEP's Appendix A, I refuse to even write code like<br><br>

<pre class="gmail-literal-block" style="box-sizing:border-box;margin:0px 0px 1.3125em;padding:0.5em;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:1.875;font-family:Consolas,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;white-space:pre-wrap;word-wrap:break-word;background-image:inherit;background-position:inherit;background-size:inherit;background-repeat:inherit;background-origin:inherit;background-clip:inherit;background-color:rgb(249,249,249);color:rgb(68,68,68);text-decoration-style:initial;text-decoration-color:initial"><font size="2">i = j = count = nerrors = 0</font></pre><font size="2">

b</font>ecause it squashes conceptually distinct things into a single statement .  I'll always write that as<br><br>

<pre class="gmail-literal-block" style="box-sizing:border-box;margin:0px 0px 1.3125em;padding:0.5em;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:1.875;font-family:Consolas,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;white-space:pre-wrap;word-wrap:break-word;background-image:inherit;background-position:inherit;background-size:inherit;background-repeat:inherit;background-origin:inherit;background-clip:inherit;background-color:rgb(249,249,249);color:rgb(68,68,68);text-decoration-style:initial;text-decoration-color:initial"><font size="2">i = j = 0
count = 0
nerrors = 0</font></pre>

instead - or even in 4 lines if `i` and `j` aren't conceptually related.<br><br>That's how annoyingly pedantic I can be ;-)   Yet after staring at lots of code, starting from a neutral position (why have an opinion about anything before examination?), I became a True Believer.<br><br>I really don't know what Guido likes best about this, but for me it's the large number of objectively small wins in `if` and `while` contexts.   They add up.  That conclusion surprised me.  That there are occasionally bigger wins to be had is pure gravy.</div><div style="font-family:arial,helvetica,sans-serif"><br>But in no case did I count "allows greater cleverness" as a win.  The Appendix contains a few examples of "bad" uses too, where cleverness in pursuit of brevity harms clarity.  In fact, to this day, I believe those examples derived from abusing assignment expressions in real-life code are more horrifying than any of the examples anyone else _contrived_ to "prove" how bad the feature is.<br><br>I apparently have more faith that people will use the feature as intended.  Not all people, just most.  The ones who don't can be beaten into compliance, same as with any other abused feature ;-)<br><br></div></div></div>
</div></div>