pygame,

Another porting for old #pygame games.

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).

  • All
  • Subscribed
  • Moderated
  • Favorites
  • python
  • DreamBathrooms
  • mdbf
  • ethstaker
  • magazineikmin
  • GTA5RPClips
  • rosin
  • thenastyranch
  • Youngstown
  • osvaldo12
  • slotface
  • khanakhh
  • kavyap
  • InstantRegret
  • Durango
  • provamag3
  • everett
  • cisconetworking
  • Leos
  • normalnudes
  • cubers
  • modclub
  • ngwrru68w68
  • tacticalgear
  • megavids
  • anitta
  • tester
  • JUstTest
  • lostlight
  • All magazines