CPython does this too (`is` is roughly the same as Java's `==`):
>>> a = 300
>>> b = 300
>>> a is b
False
>>> a = 100
>>> b = 100
>>> a is b
True
>>>
CPython has a small set of canonical objects for integers.