Why is int variable id in python 2.7 equal to only 256?

Why is int variable id's in python 2.7 only equal to 256?

For example:

 >>> y = 256 >>> m = 256 >>> m is y True >>> y = 257 >>> m = 257 >>> id(m) 16282096 >>> id(y) 16281952 >>> m is y False 
+7
python
source share

No one has answered this question yet.

See related questions:

2425
Least Surprise and Mutable Default Argument
994
How to return multiple values ​​from a function?
577
How do you get the logical xor of two variables in Python?
515
Does Python have "private" variables in classes?
115
Why in Python 0, 0 == (0, 0) is (0, False)
6
Python: Why doesn't equality comparing int with string give an error?
3
Make a memory representation of using bytearray int int in Python 2.7
0
append int ordinal to str in Python 2.7
0
Problem with global variable Python 2.7
-3
Why is the value of this expression false in python?

All Articles