<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2018-04-15 12:41 GMT+03:00 Mikhail V <span dir="ltr"><<a href="mailto:mikhailwas@gmail.com" target="_blank">mikhailwas@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-"><br>
</span>Exactly, all forms invites this and other questions.<br>
<br>
First of all, coming back to original spelling choice arguments<br>
[Sorry in advance if I've missed some points in this huge thread]<br>
<br>
citation from PEP:<br>
"Differences from regular assignment statements" [...]<br>
"Otherwise, the semantics of assignment are unchanged by this proposal."<br>
<br>
So basically it's the same Python assignment?<br>
Then obvious solution seems just to propose "=".<br>
But I see Chris have put this in FAQ section:<br>
"The syntactic similarity between ``if (x == y)`` and ``if (x = y)`` ...."<br></blockquote><div> </div><div>[OT] To be honest I never liked the fact that `=` was used in various programming languages as assignment. But it became so common that and I got used to it and even stopped taking a sedative :)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
So IIUC, the *only* reason is to avoid '==' ad '=' similarity?<br>
If so, then it does not sound convincing at all.<br>
Of course Python does me a favor showing an error,<br>
when I make a typo like this:<br>
if (x = y)<br>
<br>
But still, if this is the only real reason, it is not convincing.<br>
Syntactically seen, I feel strong that normal '=' would be the way to go.<br>
<br>
Just look at this:<br>
y = ((eggs := spam()), (cheese := eggs.method())<br>
y = ((eggs = spam()), (cheese = eggs.method())<br>
<br>
The latter is so much cleaner, and already so common to any<br>
old or new Python user. And does not raise a<br>
question what this ":=" should really mean.<br>
(Or probably it should raise such question?)<br>
<br>
Given the fact that the PEP gives quite edge-case<br>
usage examples only, this should be really more convincing.<br>
And as a side note: I personally find the look of ":=" a bit 'noisy'.<br></blockquote><div><br></div><div>You are not alone. On the other hand it is one of the strengths of Python - not allow to do so common and complex to finding bugs. For me personally, `: =` looks and feels just like normal assignment statement which can be used interchangeable but in many more places in the code. And if the main goal of the PEP was to offer this `assignment expression` as a future replacement for `assignment statement` the `:=` syntax form would be the very reasonable proposal (of course in this case there will be a lot more other questions). But somehow this PEP does not mean it! And with the current rationale of this PEP it's a huge CON for me that `=` and `:=` feel and look the same.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Another point:<br>
<br>
*Target first vs Expression first*<br>
=======================<br>
<br>
Well, this is nice indeed. Don't you find that first of all it must be<br>
decided what should be the *overall tendency for Python*?<br>
Now we have common "x = a + b" everywhere. Then there<br>
are comprehensions (somewhat mixed direction) and<br>
"foo as bar" things.<br>
But wait, is the tendency to "give the freedom"? Then you should<br>
introduce something like "<--" in the first place so that we can<br>
write normal assignment in both directions.<br></blockquote><div><br></div><div>As it was noted previously `<-` would not work because of unary minus on the right:</div><div><br></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>>>> x = 10</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>>>> x <- 5</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>False </div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Or is the tendency to convert Python to the "expression first" generally?<br>
<br>
So if this question can be answered first, then I think it will be<br>
more constructive to discuss the choice of particular spellings.<span class="gmail-HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>If the idea of the whole PEP was to replace `assignment statement` with `assignment expression` I would choose name first. If the idea was to offer an expression with the name-binding side effect, which can be used in the appropriate places I would choose expression first.</div><div><br></div><div>With kind regards,</div><div>-gdg</div></div><br></div></div>