<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On 04.07.2018 4:26, Tim Peters wrote:<br>
<blockquote type="cite"
cite="mid:CAExdVNmdCj++-thd2Qrsc=iD_Xj3pw-TYZ7CAnK-DXjg=M4KrQ@mail.gmail.com">
<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>
</blockquote>
<br>
It's not about if a syntax can be used right or wrong. It's about
how easy it is to use it right vs wrong.<br>
<br>
A syntax, any syntax, naturally nudges the user to use it in
specific ways, by making these ways easy to write and read.<br>
One of Python's hightlights is that it strives to make the easiest
solutions the right ones -- "make right things easy, make wrong
things hard".<br>
<br>
How many of the users are "professional" vs "amateur" programmers is
irrelevant. (E.g. while newbies are ignorant, pros are instead
constantly pressed for time.)<br>
Python Zen rather focuses on making it easy to write correct code
for everyone, beginners and pros alike.<br>
<br>
(As Stéfane Fermigier righly showed in message from 4 Jul 2018
11:59:47 +0200, there are always orders of magnitude more "amateurs"
than "professionals", and even fewer competent ones.)
<blockquote type="cite"
cite="mid:CAExdVNmdCj++-thd2Qrsc=iD_Xj3pw-TYZ7CAnK-DXjg=M4KrQ@mail.gmail.com">
<div dir="ltr">
<div class="gmail_quote">
</div>
</div>
<!--'"--><br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Python-Dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-Dev@python.org">Python-Dev@python.org</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/python-dev">https://mail.python.org/mailman/listinfo/python-dev</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/options/python-dev/vano%40mail.mipt.ru">https://mail.python.org/mailman/options/python-dev/vano%40mail.mipt.ru</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Regards,
Ivan</pre>
</body>
</html>