I know that the operators is
and is not
test for object identity: x is y is true if and only if x and y are the same object
I initialize two variables
i
andj
with the same value10
, and when I am comparing theid
of both variable withis
operator it gives me aFalse
even though theid(i)
andid(j)
are the same.
I need a clarification, Here is my code
>>> i = 10;
>>> j = 10;
>>> print(10==10);
True
>>> print(id(10)==id(10));
True
>>> print(10 is 10);
True
>>> print(5+5 is 10);
True
>>> print(i == j);
True
>>> print(id(i) == id(j));
True
>>> print(i is j);
True
>>> print(id(i) is id(j)); # Why this statment Evaluate to False this is my quetion?
False
>>> id(i);
140718000878704
>>> id(j);
140718000878704