I have read about how python creates objects and put "tags" for those as a variables assigned to that. However, I see that if there are two strings or integers with the same values, it allocates only one memory spot for it, unlike lists, tuples, dics. Is there a rule or list of types when one case happens but not the other? In particular, if I set
>>> x,y='a','a'
>>> x is y
True
>>> x,y=1,1
>>> x is y
True
But on the other hand, if I do
>>> x,y={'a':1},{'a':1}
>>> x is y
False
>>> x,y=(1,),(1,)
>>> x is y
False
>>> x,y=[1],[1]
>>> x is y
False