<div class="gmail_quote">On Fri, Apr 23, 2010 at 7:18 PM, Chris Rebert <span dir="ltr"><<a href="mailto:pyideas@rebertia.com">pyideas@rebertia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div id=":kn" class="ii gt">Master Yoda had me google "python-ideas if assignment", which was fruitful:<br>
<br>
[Python-ideas] Inline assignment expression:<br>
<a href="http://mail.python.org/pipermail/python-ideas/2009-March/003423.html" target="_blank">http://mail.python.org/pipermail/python-ideas/2009-March/003423.html</a><br>
<br>
Post in same thread summarizing rejection reasons:<br>
<a href="http://mail.python.org/pipermail/python-ideas/2009-March/003440.html" target="_blank">http://mail.python.org/pipermail/python-ideas/2009-March/003440.html</a></div></blockquote></div><br><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Thanks! But, I'm not really thinking about creating an inline assignment expressions: those feel un-Pythonic the same way the ++ operator is.</font><div>

<font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">I'm talking about anaphoric if: that is, extending the if_stmt to include ["as" target] after its expression. Actually, that seems to be what the original bug filed was about [1], *not* anything to do with assignment expressions or funky "backwards assignment" syntax who-knows-where.</font><div>

<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-family: arial; "><div>

<font class="Apple-style-span" face="arial, helvetica, sans-serif">On Mar 15, 2009, Nick Coghlan wrote:</font></div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

<font class="Apple-style-span" face="arial, helvetica, sans-serif">If you look at the current uses for 'as' it is never for direct assignment:</font></blockquote><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br>

</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-family: arial; "><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Right, it's used for a different kind of assignment each time. The commonality is that it's used for the "appropriate" assignment for the context, with the target appearing after "as".</font></div>

</span></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-family: arial; "><br><div class="gmail_quote">On Fri, Apr 23, 2010 at 8:23 PM, Jess Austin <span dir="ltr"><<a href="mailto:jess.austin@gmail.com">jess.austin@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

<div id=":1fu" class="ii gt">A question for the sake of completeness: would "if not foo() as x: ... x" mean "x = foo(); if not x: ... x"?</div></blockquote></div></span></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br>

</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">No, it would mean: "x = not foo(); if x: ...x". That is, it would be part of the "if" statement, assigning the value of the expression after "if" to the target after "as". It doesn't make sense to me to make exceptions for one kind of expression over another.</font></div>

<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-family: arial; "><div class="gmail_quote">

On Fri, Apr 23, 2010 at 8:26 PM, Raymond Hettinger <span dir="ltr"><<a href="mailto:raymond.hettinger@gmail.com">raymond.hettinger@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

<div>FWIW, I'm +1 on the idea, especially if it can be also applied to while-loops.</div></blockquote><div><br></div><div>Yup, using doing the same for while-loops makes even more sense.</div><div><br></div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

<div>It looks very readable</div></blockquote><div><br></div><div>Agreed.</div><div> </div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

<div></div><div>We do have a language moratorium in effect, so your odds of success are slim.</div></blockquote><div><br></div><div>Patiently counting down the days... :)</div></div></span></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br>

</font></div></span></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Cheers,</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Andrey</font></div></div>

</div></div>