From what I understand, the ==
operator checks if two variables are equal, while the is
operator checks if two variables have the same identity/ reference the same object. So why is print(id(a) is id(b))
False
? Don't the two variables reference the same integer?
a = 1000000000
b = 1000000000
print(id(a)) #182798416
print(id(b)) #182798416
print(id(a) is id(b)) #False
print(id(a) == id(b)) #True
print(182798416 is 182798416) #True