Python has a cache of small numbers so the objects are actually the same. So the identity comparison works for small numbers.
a = 768
b = 768
a is b == False
a = 76
b = 76
a is b == True
You might encounter this when comparing “e.type is KEYDOWN”. This worked with pygame 1.9.6… because the numbers used were lower. pygame 2 uses larger numbers causing the comparison to fail.
Tip: avoid using “is” when “==“ will do (which is almost always).