While the pattern for testing multiple values
>>> 2 in {1, 2, 3}
True
>>> 5 in {1, 2, 3}
False
is very readable and is working in many situation, there is one pitfall:
>>> 0 in {True, False}
True
But we want to have
>>> (0 is True) or (0 is False)
False
One generalization of the previous expression is based on the answer from ytpillai:
>>> any([0 is True, 0 is False])
False
which can be written as
>>> any(0 is item for item in (True, False))
False
While this expression returns the right result it is not as readable as the first expression :-(