I have 2 variables (links) a and b that are pointing to the same object, and, of course
a is b #true
But when im asking about memory addr for the same object that this links pointing to
id(a) is id(b) #false
Does that mean that id is creating a new object ? How long will this object last ? What type will it be? What’s going on?
>Solution :
>>> a is b
True
They are the same object…
>>> id(a) == id(b)
True
They have the same id…
>>> id(a) is id(b)
False
…but the integers representing their ids are not the same object.
That’s because in Python ints are objects too.
I would suggest you to read this, this and this.