I'm using Python 3.8.10 and I don't get why the id
s are different in the following example.
In this case, the id
s are the same.
>>> a = "latter"
>>> b = "latter"
>>> a is b
True
>>> id(a)
139821162817136
>>> id(b)
139821162817136
However, if I add an ':'
, the two strings have different id
s.
>>> a = "latter:"
>>> b = "latter:"
>>> a is b
False
>>> id(a)
139821163527280
>>> id(b)
139821162817200
I don't get what exactly is happening.