3 ms·
x=1; id(x); x+=1; id(x); # different id, means x points to new location x=[1,2],id(x), x+=[3], id(x) ; # same id, means x stay at the original location there
by ausjke 7y ago
x=1; id(x); x+=1; id(x); # different id, means x points to new location
x=[1,2],id(x), x+=[3], id(x) ; # same id, means x stay at the original location
there should be a blog page to list those surprises for beginners :)