<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    On 03/07/2018 06:47, Tim Peters wrote:<br>
    <blockquote type="cite"
cite="mid:CAExdVNnHa_OWBuNgHCwuavzApb42iS++h1eMuEgb_F3VHrVEvg@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_quote">
          <div dir="ltr">[Rob Cliffe]<br>
            > It's late to raise this,<br>
            <br>
            By months, yes ;-)<br>
            <br>
            > but what exactly are the objections to the syntax<br>
          </div>
          >         expr -> name  # or variations such as  expr
          => name<br>
          > instead of<br>
          >         name := expr<br>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
          </blockquote>
          ><br>
          > The PEP mentions that this syntax does not have a problem
          that "as" <br>
          > does, but does not list any downsides of it.<br>
          <br>
          My guess:  it probably strikes too many as "excessive
          novelty",   These are assignment expressions.  Python's
          assignment statements put the target at the left.  Why change
          that?  ":=" is used for assignment in many more other
          languages than "->" is.  Why fight that?<br>
          <br>
          > It conforms to left-to-right evaluation, where name:=expr
          does not.<br>
          <br>
          ?  Only "expr" is evaluated, so left-to-right seems irrelevant
          here.  The "evaluation" of a simple name as a binding target
          is a no-op (no code is generated).  If you really do see this
          as a wart anyway, then it's positively a Good Thing that it's
          exactly the same "wart" as in Python's assignment statements.<br>
          <br>
          > It (I would argue) reduces the asymmetry of the first use
          of a</div>
        <div class="gmail_quote">> sub-expression in cases such as<br>
          >     [ ( (f(x) -> y)**2, y**3, y**4) for x in iterable
          ]<br>
          >  vs<br>
          >     [ ( (y := f(x))**2, y**3, y**4) for x in iterable ]<br>
          > because the first "y" is closer to the way it is used,
          viz "**2".<br>
          <br>
          The first form reads a little better to me too, but not a lot
          better.  The problem I have with variations of this example on
          its own (which comes up surprisingly often with minor changes)
          is that it's clearer spelled today via<br>
          <br>
              [(y**2, y**3, y**4) for y in map(f, iterable)]<br>
          <br>
          Spelling that with either form of assignment expression reads
          significantly worse than that to my eyes<br>
          <br>
        </div>
        <div class="gmail_quote">But more importantly, it's expected
          that assignment expressions will be used _most_ often to make
          some common `if` and `while` patterns briefer.  Hardly all. 
          Our eyes are already trained to "look at the far right end"
          for the value being tested, and, e.g.,<br>
          <br>
          <div class="gmail_quote">    while data := sock.recv():</div>
          <div class="gmail_quote"><br>
          </div>
          <div class="gmail_quote">preserves that.  Especially in code
            that doesn't _always_ use assignment expressions in such
            contexts (which is likely all significant blobs of code), it
            would be visually jarring to have to "sometimes look in the
            middle instead" to extract the important part of:<br>
            <br>
            <div class="gmail_quote">    while sockrecv() -> data:<br>
              <br>
              "Look to the left for the name, look to the right for the
              value" is the rule for assignment statements, assignment
              expressions, and `for` loop targets.<br>
              <br>
              But there's no "QED" here because this isn't a deductive
              science.  The final answer is "because that's what Guido
              liked best" ;-)<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    Thanks, Tim, for a thoughtful answer.<br>
    Don't get me wrong, I feel quite happy with ":=".  Perhaps you have
    managed to articulate some thoughts that were buried in my
    subconscious.  It's just that I couldn't come up with any rational
    objections to "->".<br>
    Rob Cliffe
    <blockquote type="cite"
cite="mid:CAExdVNnHa_OWBuNgHCwuavzApb42iS++h1eMuEgb_F3VHrVEvg@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_quote">
          <div class="gmail_quote">
            <div class="gmail_quote"><br>
            </div>
          </div>
        </div>
      </div>
      <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
        <table style="border-top: 1px solid #D3D4DE;">
          <tbody>
            <tr>
              <td style="width: 55px; padding-top: 13px;"><a
href="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient"
                  target="_blank" moz-do-not-send="true"><img
src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-green-avg-v1.png"
                    alt="" style="width: 46px; height: 29px;"
                    moz-do-not-send="true" height="29" width="46"></a></td>
              <td style="width: 470px; padding-top: 12px; color:
                #41424e; font-size: 13px; font-family: Arial, Helvetica,
                sans-serif; line-height: 18px;">Virus-free. <a
href="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient"
                  target="_blank" style="color: #4453ea;"
                  moz-do-not-send="true">www.avg.com</a> </td>
            </tr>
          </tbody>
        </table>
        <a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1"
          height="1" moz-do-not-send="true"> </a></div>
    </blockquote>
    <br>
  </body>
</html>