It&#x27;s actually more complicated than that. CPython will cache constants within a scope, so<p><pre><code>    a = 500
    b = 500
    a is b
</code></pre>
will give `True`. But the REPL forces each line to compile separately and CPython won&#x27;t cache across them. However, there&#x27;s a global cache for integers less than 256 so in that case they&#x27;re `is`-equivalent even in the REPL.