
(I-=-1) - marvindanig
https://twitter.com/codepo8/status/1186581782864564224
======
raymondh
Earlier post:
[https://twitter.com/raymondh/status/1131103570856632321](https://twitter.com/raymondh/status/1131103570856632321)

~~~
ThePadawan
I just learned that Python allows overriding __isub__ separately from __sub__
and the same for __iadd__ [0].

Really interesting!

[0]
[https://docs.python.org/3/reference/datamodel.html#object.__...](https://docs.python.org/3/reference/datamodel.html#object.__isub__)

~~~
mixedmath
Thank you. I never thought to consider the possibility of making these be
separate. Interesting.

------
metalliqaz
Why was he surprised that it works? -1 is a perfectly normal integer and -= is
a perfectly valid operator.

~~~
seasoup
I think that while people wouldnt be surprised that

i -= -1

works, formatted as

i-=-1

it's unclear what each - is doing, likely someone did it because it looks nice
and symmetrical, as opposed to

i+=1

~~~
supereggbert
Probably because in js if i="1" then i+=1 results in i="11" but i-=-1 results
in i=2

