Can someone please explain the following cases?
In case I, I thought of something reverse. For small objects, e.g., 1, python could allocate new objects for different references. But for large objects, e.g., 10000..., python could keep reusing the same memory. But case I here clearly shows the opposite.
In case II, both 'a' and 'b' refer to large objects. If case I makes sense, why assigning a tuple to 'a' and 'b' ends up with 'a' and 'b' having the same id?
Case I
>>> a = 1
>>> b = 1
>>> id(a), id(b)
(140293399709656, 140293399709656)
>>> a = 100000000000000000
>>> b = 100000000000000000
>>> id(a), id(b)
(140293400116296, 140293400116344)
Case II
>>> a = 100000000000000000
>>> b = 100000000000000000
>>> id(a), id(b)
(140293400116296, 140293400116344)
>>> a, b = 100000000000000000, 100000000000000000
>>> id(a), id(b)
(140293400116320, 140293400116320)