Hello all,
I’m running into a weird issue. I have this code where I’m comparing integers using the is
operator:
I expected the result to be True
, but it’s actually False
. From what I’ve learned, is
checks if two variables point to the same object in memory, so I thought integers like 1000 would be cached and reused.
Can anyone explain why this happens? Should I use ==
for integer comparisons instead of is
?