How does tuple unpacking differ from normal assignment?

Viewed 163

From this link I learnt that

The current implementation keeps an array of integer objects for all integers between -5 and 256, when you create an int in that range you actually just get back a reference to the existing object

But when I tried to give some example for my session and I found out that it behaves differently with assignment and tuple unpacking.

Here is the snippet:

>>> a,b = 300,300
>>> a is b
True
>>> c = 300
>>> d = 300
>>> c is d
False
2 Answers
Related