I already looked at this question, but I don't really get why the two id()
calls return an identical value, while the is
comparison returns False
.
>>> [2,2,2] + [1] == [2,2,2,1]
True
>>> [2,2,2] + [1] is [2,2,2,1]
False
>>> id([2,2,2] + [1])
4396847688
>>> id([2,2,2,1])
4396847688
To be sure, I did expect the two comparisons to return True
and False
as they did, I just don't get why the ids are not different.