I'm trying to compare variables using is
operator. Here's what I've done
def get_no():
return 1234
a = get_no()
b = 1234
c = 1234
print(a is 1234) #False
print(a is b) #False
print(b is c) #True
a is b
is expected to be False
as both are pointing to different values. But, why is b is c
returning True
?. Why is the function get_no()
causing a difference here?