A colleague of mine wrote something like the following:
list = [1,2,3]
m = 5;
if m in list == False:
print("not in list")
else:
print("in list")
This small test program will output:
"in list"
Which is sort of incorrect (not desired, anyway).
We know this isn't the pythonic way to write it (that would have been just write not in
to see if it's in the list) - but even then we want to know what's going on as it is surprising behavior.
Note that:
if (m in list) == False:
is enough to fix it.
What's going on?