On Sat, Jun 16, 2018 at 1:48 AM, Mikhail V <mikhail...@gmail.com> wrote: > On Fri, Jun 15, 2018 at 5:51 AM, Michael Selik <m...@selik.org> wrote: > >> If you would like to prove the need for this operator, one piece of evidence >> you can provide is a count of the number of times someone writes >> "list.append" for an iterable vs "+=" and encloses a str or other type in a >> throw-away list to effectively append. > > That's strange idea - there is no doubt that one would use > list.append() and most probably > it is the case statistically. > So the question would be "what is wrong with list.append()?" > And as said many times, there is nothing wrong, but a lot of people > seem to want an in-place > operator for this purpose. And I can understand this, because: > > 1. append() is _ubiquitous_ > 2. in-place assignment form makes some emphasis on mutating, in > contrast to method call.
How so? You can write "x += 1" with integers, and that doesn't mutate; but if you write "x.some_method()", doing nothing with the return value, it's fairly obvious that it's going to have side effects, most likely to mutate the object. Augmented assignment is no better than a method at that. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/