Two 257s, One Object
This runs under CPython, as a script (not typed interactively at the REPL).
a = 257
b = 257
print(a is b)
A teammate sees this print True and concludes that CPython must cache all integers up to at least 257, not just the documented -5 to 256 range. What's actually going on, and why is their conclusion wrong?
Sign in to answer questions and track your progress
Sign In