<div dir="auto"><div>The case I find more reasonable is assignment in earlier arguments:</div><div dir="auto"><br></div><div dir="auto">z = something ()</div><div dir="auto">w = myfun(x := get_data(), y=calculate(x, z))</div><div dir="auto"><br></div><div dir="auto">I would probably recommend against that in code review, but it's not absurdly obfuscated.<br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Sun, Jul 8, 2018, 1:15 PM Giampaolo Rodola' <<a href="mailto:g.rodola@gmail.com">g.rodola@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Sun, Jul 8, 2018 at 6:45 PM Steve Holden <<a href="mailto:steve@holdenweb.com" target="_blank" rel="noreferrer">steve@holdenweb.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-size:small">On Sun, Jul 8, 2018 at 10:41 AM, Giampaolo Rodola' <span dir="ltr"><<a href="mailto:g.rodola@gmail.com" target="_blank" rel="noreferrer">g.rodola@gmail.com</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"><div dir="ltr"><div class="gmail_quote"><span><div dir="ltr"><div style="font-size:small;display:inline">[...]</div></div></span><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I find that (space between the <span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">parentheses of a </span>function call statement) too unnatural as a place where to put an assignment</span>. It is not even "guarded" by a keyword like "if" or "while" which can help as indicators that an assignment may occur. Also, I think it's way too easy to confuse it with a keyword argument:</div><div><br></div><div> >>> foo(x = 1) # keyword arg</div><div> >>> foo(x := 1) # assignment + value passing</div><div><div style="font-size:small">[...]</div></div></div></div></blockquote><div></div></div><br></div><div class="gmail_extra"><div style="font-size:small">But the PEP 8 spellings are</div><div style="font-size:small"><br></div><div style="font-size:small"> foo(x=1)</div><div style="font-size:small"><br></div><div style="font-size:small">and</div><div style="font-size:small"><br></div><div style="font-size:small"> f(x := 1).</div><div style="font-size:small"><br></div><div style="font-size:small">The extra spacing makes it obvious that this isn't a regular named argument.</div></div></div></blockquote><div><br></div><div>What if the author of the code I'm reading didn't respect PEP-8? I don't think it's fair to invoke PEP-8 as a counter-measure to obviate a syntax which can clearly be mistaken with something else simply by omitting 2 spaces. Not to mention that I don't see why anyone would want to declare a variable in there in the first place.</div><div> </div></div>-- <br><div dir="ltr" class="m_-4694172587648480051gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Giampaolo - <a href="http://grodola.blogspot.com" target="_blank" rel="noreferrer">http://grodola.blogspot.com</a></div><div><br></div></div></div></div>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank" rel="noreferrer">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/mertz%40gnosis.cx" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/mertz%40gnosis.cx</a><br>
</blockquote></div></div></div>