I know this is bad practice:
>>> a = 5
>>> a.__radd__(5)
10
>>> a
5
>>> a.__iadd__(5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'int' object has no attribute '__iadd__'
Out of curiosity, if an int object doesn't have __iadd__
, then how does +=
work?