‘is’ vs ‘==’ in Python – Object Comparison
‘is’ vs ‘==’ in Python Python has two very similar operators for checking whether two objects are equal. These two operators are is and ==. They are usually confused with one another because with simple data types, like ints and strings (which many people start learning Python with) they seem to do the same thing: x = 5 s = “example” print(“x == 5: ” + str(x == 5)) print(“x is 5: ” + str(x is 5)) print(“s == ‘example’: […]
Read more