I know Python has a cache for objects with numerical values between -5 and 256. I can confirm this in Python interactive window (console). For example,
a = -10
b = -10
print(id(a))
1797396904912
print(id(b))
1797396904976
print(id(a) == id(b))
False
However, when I run exactly the same code via a script:
a = -10
b = -10
print(id(a))
print(id(b))
print(id(a) == id(b))
I get:
1797396904848
1797396904848
True
What's going on? (The question has nothing to do with another question on id of strings with and without a space).