aman khan1 month agoMost voted8
CPython keeps cached int objects from -5 to 256, so every 256 is the same object. 257 gets created fresh each time in the REPL.
If you put the same code in a .py file it might print True for 257 too, because constants in one code block get reused.
Use == for values, `is` only for None.