Example 1:
➜ /tmp cat t.py
a = 250000000000
b = 250000000000
print id(a), id(b), id(a) == id(b)
➜ /tmp python t.py
140450848587992 140450848587992 True #(Why is True?)
Example 2:
➜ /tmp python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 250000000000
>>> b = 250000000000
>>> print id(a), id(b), id(a) == id(b)
140443481339400 140443481339208 False #(I think it should be False)
I know Python has a small integer cache pool(from -5 to 256), so two big integers should have different id all the time.
How to explain the different behaviours of big integer when run in Python shell and *.py file ?