Skip to content
Opensource internals
  • Posts

Integers

How CPython Caches Small Integers

May 2, 2026 4 min read Jay Hubbert

In CPython, a = 1; b = 1; a is b is True. That identity is not an accident of the language semantics; it is a deliberate C-level optimization. Every integer in the range -5 to 1024 …

PythonCpythonInternalsPerformanceIntegers

Read more →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·