I am trying to test the in-place addition claim of += in python, this is my code:
>>> a=1
>>> id(a)
4346593520
>>> a+=1
>>> id(a)
4346593552
As you can see, the addresses are different, but could it be due to the fact that 4346593552
holds the value 2
already?
Because, when I am assigning same values to two different variable, their addresses turn out to be the same. i.e.
>>> b=13
>>> c=13
>>> id(b)==id(c)
True
Please clarify if I am correct in my assumption, otherwise the in-place addition looks skeptical to me