difference between "==" and "is"

i have been using “is” for my code, when reading boolean variables with True and False like this

as opposed to this

maybe “==” and “is” are not too different here, but what about other situations?

‘==’ is used to determine if two values are equal whereas “is” tells you if two “objects” are the same.

Example:
a = [1,2,3]
b = [1,2,3]

a==b --> True
a is b --> False

** Also, note from your example that instead of:

if myVar is True:

OR

if myVar == True:

You can write it this way:

if myVar:

and

if not myVar:

For the record, it may not make sense to compare Panda’s wrapped C++ objects with “is”, if you need a pointer comparison do it like this:

if a == b:
  print "A and B are equal"

if a.this == b.this:
  print "A and B are the same object"

For normal Python objects it would look like:

if a == b:
  print "A and B are equal"

if a is b:
  print "A and B are the same object"

as a side note:
‘is’ is faster than ‘==’, especially if your objects are complex

Yeah, but when you want to do a comparison, you shouldn’t use “is”.