<div dir="ltr"><div class="gmail_default" style="font-size:small">On Mon, Apr 23, 2018 at 8:28 AM, Antoine Pitrou <span dir="ltr"><<a href="mailto:solipsis@pitrou.net" target="_blank">solipsis@pitrou.net</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, 23 Apr 2018 00:44:44 -0500<br>
Tim Peters <<a href="mailto:tim.peters@gmail.com">tim.peters@gmail.com</a>> wrote:<br>
<div class="gmail_default" style="font-size:small;display:inline">​[...]</div><br>
<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> if (diff := x - x_base) and (g := gcd(diff, n)) > 1:</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">>     return g</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">> That's so Pythonic I could cry ;-)<br>
<br>
</span><div class="gmail_default" style="font-size:small;display:inline">​[...]</div><br>
The second part, especially, where you use the result of an<br>
assignment expression as a comparison operand, looks definitely<br>
un-Pythonic.<br>
<br></blockquote><div><div class="gmail_default" style="font-size:small;display:inline">​Which, I suppose, underlines that Pythonicity is in the mind of the beholder.​</div> </div><div><br></div><div><div class="gmail_default" style="font-size:small">The assignment expression seems like a vary natural way to introduce variables of limited (controlled?) scope, and the class-namespace special case doesn't seem horrible enough to put me, at least, off the idea. There will, of course, be those who abuse assignment expressions, and I'm very much looking forward to seeing what David Beazley makes of them.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">While Tim's expression might look (superficially) like C, the five-line alternative isn't exactly an inspiring example of Pythonicity, is it?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">regards</div><div class="gmail_default" style="font-size:small"> Steve</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><br></div></div></div></div>