Why does "not(True) in [False, True]" return False?
If I do this:
>>> False in [False, True] True
True. Simply because
False is in the list.
But if I do:
>>> not(True) in [False, True] False
not(True) is equal to
>>> not(True) False
>>> not (True in [False, True]) False
This is what you want:
>>> (not True) in [False, True] True
As @Ben points out: It's recommended to never write
not True. The former makes it look like a function call, while
not is an operator, not a function.