From the CPython documentation here, is stated that:
The current implementation keeps an array of integer objects for all integers between -5 and 256, when you create an int in that range you actually just get back a reference to the existing object.
Which makes this comparison true:
>>> a = -3
>>> b = -3
>>> a is b
True
I'm wondering what is the reason behind this, why are some numbers pre-allocated and why those numbers in particular?