[issue46612] Unclear behavior of += operator

Vedran Čačić report at bugs.python.org
Wed Feb 2 11:59:52 EST 2022


Vedran Čačić <vedgar at gmail.com> added the comment:

You've managed to write 3 messages already, without at any point mentioning what _really_ happens when you += something.

    a += b means (is closest to) a = type(a).__iadd__(a, b)

You focus all the time on __iadd__ call, disregarding that its result it assigned back to a in scope.

----------
nosy: +veky

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46612>
_______________________________________


More information about the Python-bugs-list mailing list