3 ms·
The inconsistency is that for immutable objects (or more generally, objects that have __add__ but not __iadd__), '+=' does create a name binding. After 'a = 30
by roelschroeven 5y ago
The inconsistency is that for immutable objects (or more generally, objects that have __add__ but not __iadd__), '+=' does create a name binding.
After 'a = 300; b = 50000',
a += b
is exactly the same as
a = a + b
In this case, a new object is created with the value of a + b which then gets bound to the name a.