News for hackers. Stuff that matters.
Re:Remove the ++ and –- operators by dbpokorny on Friday December 04, 2015 @01:33PM (#10678104)
> The only time you should actually override __iadd__ is for mutable objects

What would the rationale be for such a rule?

the docs don't mention anything like that https://docs.python.org/2/library/operator.html and I've never heard it before. In Python, neither integers nor strings are mutable and both support the "x += y" syntax.

The __iadd__ method works the same for both mutable and immutable objects AFAIK

Re:Remove the ++ and –- operators by Veedrac on Saturday December 05, 2015 @05:01AM (#10681438)
> What would the rationale be for such a rule?

Because __iadd__ automatically delegates to __add__. For immutable objects that's the best you can do, so there's no reason to write both.