<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">> As I see it, you are mixing very different things. Augmented operators 
in Python work on objects, generally trying to mutate them in-place. So 
usually after these operations you have the same object (with the same 
type, with the same name and etc.) as before these operations. Of course
 there are exceptions, for example all immutable types or some 
promotions between numbers.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">Yep.<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">>>> a = (5, 2)<br>>>> a += (3, )<br>>>> a<br>(5, 2, 3)</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">> In your examples some cases imply that you are working on
 names, others that you are working on objects. And as for me this 
ambiguity is not solvable. <br><div dir="ltr"><br></div><div>example please? Show an ambiguous case. To me, it's always working on names. <br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Sep 27, 2018 at 5:32 PM Kirill Balunov <<a href="mailto:kirillbalunov@gmail.com" target="_blank">kirillbalunov@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"><div dir="ltr"><div dir="ltr">As I see it, you are mixing very different things. Augmented operators in Python work on objects, generally trying to mutate them in-place. So usually after these operations you have the same object (with the same type, with the same name and etc.) as before these operations. Of course there are exceptions, for example all immutable types or some promotions between numbers.</div><div dir="ltr"><br></div><div dir="ltr">In your examples some cases imply that you are working on names, others that you are working on objects. And as for me this ambiguity is not solvable. </div><div dir="ltr"><br></div><div dir="ltr">With kind regards,</div><div dir="ltr">-gdg<br><br><div class="gmail_quote"><div dir="ltr">ср, 26 сент. 2018 г. в 14:14, Jasper Rebane <<a href="mailto:rebane2001@gmail.com" target="_blank">rebane2001@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>When using Python, I find myself often using assignment operators, like 'a += 1' instead of 'a = a + 1', which saves me a lot of time and hassle</div><div><br></div><div>Unfortunately, this doesn't apply to methods, thus we have to write code like this:</div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">   </span>text = "foo"</div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">  </span>text = text.replace("foo","bar")</div><div><div><span style="color:rgb(0,0,0);white-space:pre-wrap"> # "bar"</span> </div></div><div><br></div><div>I propose that we should add '.=' as a method return value assignment operator so we could write the code like this instead:</div><div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">  </span>text = "foo"</div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">  </span>text .= replace("foo","bar")</div></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">    # "bar"</span> <br></div><div>This looks cleaner, saves time and makes debugging easier</div><div><br></div><div>Here are a few more examples:</div><div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">   </span>text = " foo "</div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">        </span>text .= strip()</div></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">     </span># "foo" <br></div><div><br></div><div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">       </span>text = "foo bar"</div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">      </span>text .= split(" ")</div></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">        # </span><font color="#000000"><span style="white-space:pre-wrap">['foo', 'bar']</span></font> </div><div><br></div><div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">       </span>text = b'foo'</div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">   </span>text .= decode("UTF-8")</div></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">   # "foo"</span> <br></div><div><br></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">  foo = </span> {1,2,3}</div><div><span style="color:rgb(0,0,0);white-space:pre-wrap"> bar = {2,3,4}</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">   foo .= difference(bar)</span> <br></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">      # {1}</span> <br></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">       </span> </div><div> <br></div><div>Rebane</div></div></div></div></div></div></div></div>
_______________________________________________<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/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div></div></div></div>
_______________________________________________<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/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div>