by arcticbull · 6y ago · 0 comments
>>> x = 25 * 37
>>> y = 25 * 37
>>> x is y
False
>>> x == y
True
From my understanding, '==' checks for equality and 'is' checks that the variables reference the same address.
>>> a=16
>>> a*a is a*a
True
>>> a=17
>>> a*a is a*a
False
WTF >>> True == False is False
False
>>> False == True is False
FalseOr read the very first part of the linked page that shows:
>>> (True == False) is False
True
>>> True == (False is False)
TrueYou'd be correct to use 'is' to mean 'is', and '==' to mean '==', following their definitions.
Other than that, just don't use `is`.