<div dir="ltr"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;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">Well this may be crazy sounding, but we could allow left or right assignment with </span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;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;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;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;text-decoration-style:initial;text-decoration-color:initial">name := expr</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;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;text-decoration-style:initial;text-decoration-color:initial">expr =: name</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;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;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;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;text-decoration-style:initial;text-decoration-color:initial">Although it would seem to violate the "only one obvious way" maxim, at least it avoids this overloaded meaning with the "as" of "except" and "with"</div><br class="gmail-Apple-interchange-newline"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 13, 2018 at 9:29 AM, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 04/13/2018 06:18 AM, Steven D'Aprano wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, Apr 13, 2018 at 09:56:35PM +1000, Chris Angelico wrote:<br>
</blockquote>
<br>
</span><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If we agree that the benefit of putting the expression first is<br>
sufficiently large, or that the general Pythonic look of "expr as name"<br>
is sufficiently desirable (it just looks and reads nicely), then we can<br>
afford certain compromises. Namely, we can rule that:<br>
<br>
     except expr as name:<br>
     with expr as name:<br>
<br>
continue to have the same meaning that they have now and never mean<br>
assignment expressions. Adding parens should not change that.<br>
</blockquote>
<br></span>
+1<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In other words, the rule is that "expr as name" keeps its current, older<br>
semantics in with and except statements, and NEVER means the new, PEP<br>
572 assignment expression.<br>
<br>
Yes, that's a special case that breaks the rules, and I accept that it<br>
is a point against "as". But the Zen is a guideline, not a law of<br>
physics, and I think the benefits of "as" are sufficient that even<br>
losing a point it still wins.<br>
</blockquote>
<br></span>
+1<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2) Forbid any use of "(expr as name)" in the header of a 'with' statement<br>
</blockquote>
<br>
You can't forbid it, because it is currently allowed syntax (albeit<br>
currently without the parens). So the rule is, it is allowed, but it<br>
means what it meant pre-PEP 572.<br>
</blockquote>
<br></span>
+1<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If people agree with me that it is important to put the expression first<br>
rather than the target name, then the fact that statements and for loops<br>
put the name first shouldn't matter.<br>
</blockquote>
<br></span>
+1 to expression coming first!  ;)<br>
<br>
--<br>
~Ethan~<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
</div></div></blockquote></div><br></div>