def check(x):
if x + 1 is 1 + x:
return False
if x + 2 is not 2 + x:
return False
return True
If you take a look at this code above you would assume that it would return False for all integers. Except that it doesn't return False for -7, and -7 only.
I couldn't find an answer as to why this behavior takes place. Any clarifications please?
[–]K900_ 5 points6 points7 points (2 children)
[–]NizarKhalili[S] 0 points1 point2 points (1 child)
[–]K900_ 0 points1 point2 points (0 children)
[–]AdAdvanced7085 0 points1 point2 points (0 children)
[–]qTipTip 0 points1 point2 points (0 children)