It is understood that the storage location of integer objects in Python is different in the storage location of Python integer objects. some of them are pre-allocated memory, which is always stored in the memory, while others, the space is opened up during use.
For the reason of this sentence, you can look at the following code:
A = 5b = 5a is B # Truea = 500b = 500a is B # False
The code above shows that integer 5 always exists, while integer 500 never exists.
Which integers are pre-allocated memory addresses?
A, B, c = 0, 0, 0i = 0 while a is B: I + = 1 a, B = int (str (I )), int (str (I) else: print (I) # prints 257
As we know, non-negative integers smaller than or equal to 256 (2 ** 8) are stored all the time (that is, their memory addresses are pre-opened and do not need to be distributed later)
A =-1b =-1a is B # False
Negative numbers are not pre-opened.