Is vs is equal to (==)?


Simple question here. I’ve been tearing through this awesome game the past few days, so let me just say thanks and keep up the good work! Anyways:

What is the difference between:

if enemy.type == “burl”


if enemy.type is “burl”

They seem to both do the same thing, so i’m just looking for a more thorough understanding. Thanks!


Apparently there’s a difference:


One more as additional for the @zuf’s answer.
For Python2:

"word"  == u"word" # True
"word" is u"word" # True

It can get really surprising results if you are using is instead == for the real software (backend web server for example). I prefer to use ==. Only one exception when I need to check that a variable is None.