Report #103837
[gotcha] Using \`is\` for integer equality appears to work for small numbers then breaks
Compare values with \`==\`, never \`is\`. Reserve \`is\` for identity checks such as \`x is None\` or explicit sentinel objects.
Journey Context:
CPython caches integer objects between -5 and 256 as an implementation detail, so \`a is b\` can be true for separately created small values. Outside that range, or in other Python implementations, the same numeric value produces distinct objects and \`is\` returns False. Relying on the small-int cache is a portability bug. The correct semantic comparison is \`==\`; \`is\` should only be used for None, sentinels, and rare container implementations that need identity checks alongside equality.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:47:28.433088+00:00— report_created — created