a = 10 # range -5 to 256
b = 10 # range -5 to 256
print(id(a))
print(id(b))
print(a is b)
# OK THAT'S FINE
BUT
a = 10 # range -5 to 256
b = 10 # range -5 to 256
print(id(a))
print(id(b)) # same memory adress
print(a is b)
# That's working
c = 3 # range -5 to 256
d = 5 # range -5 to 256
print(id(c))
print(id(d))
print(c is d)
NOT same memory adress O_o False because... meeeehhh the range should be fine !
With the following illustration, you should understand why:
a is b
is Truec is d
is Falsefor the number between -5 and 256
and why:
e is f
is Falsefor other numbers outside of this special range