checking_set = set(("a", "b", "c", "d")) # initialisation; do this once
if foo in checking_set: # when you need it
Advantages: (1) give the set of allowable values a name (2) may be faster if the number of entries is large
Edit some timings in response to "usually much slower" when only "a handful of entries" comment:
>python -mtimeit -s"ctnr=('a','b','c','d')" "'a' in ctnr"
10000000 loops, best of 3: 0.148 usec per loop
>python -mtimeit -s"ctnr=('a','b','c','d')" "'d' in ctnr"
1000000 loops, best of 3: 0.249 usec per loop
>python -mtimeit -s"ctnr=('a','b','c','d')" "'x' in ctnr"
1000000 loops, best of 3: 0.29 usec per loop
>python -mtimeit -s"ctnr=set(('a','b','c','d'))" "'a' in ctnr"
10000000 loops, best of 3: 0.157 usec per loop
>python -mtimeit -s"ctnr=set(('a','b','c','d'))" "'d' in ctnr"
10000000 loops, best of 3: 0.158 usec per loop
>python -mtimeit -s"ctnr=set(('a','b','c','d'))" "'x' in ctnr"
10000000 loops, best of 3: 0.159 usec per loop
(Python 2.7, Windows XP)