Python's Integer Interning Trap

a = 256 b = 256 print(a is b) # True  x = 257 y = 257 print(x is y) # False (in REPL!) 

⚡ The Small Integer Cache

CPython allocates a fixed table of integer objects spanning [-5, 256] during interpreter initialization.

Because integers are immutable, caching frequently used numbers saves massive memory overhead.

Read the full breakdown on Binary Dose.