>>> x = [1,2,3]
>>> y = [1,2,3]
>>> print id(x),id(y)
43259384 43258744
>>> x = 1
>>> y = 1
>>> print id(x),id(y)
5417464 5417464
As you can see the IDs are different for the first print but the same for the second print. Why? What determines whether or not the IDs of 2 variables will be the same after they have been assigned the same value?