I guess timeit
is a thing. Here are the results:
$ python -m timeit "x=True if 'my_variable' in ['just', 'three', 'options'] else False"
10000000 loops, best of 3: 0.0643 usec per loop
$ python -m timeit "x=True if 'my_variable' in ('just', 'three', 'options') else False"
10000000 loops, best of 3: 0.0645 usec per loop
$ python -m timeit "x=True if 'my_variable' in {'just', 'three', 'options'} else False"
10000000 loops, best of 3: 0.113 usec per loop
Longer set of options:
$ python -m timeit "x=True if 'my_variable' in ['a', 'much', 'longer', 'list', 'of', 'choices', 'but', 'still', 'nothing', 'crazy', 'and', 'perhaps', 'you', 'could', 'actually', 'find', 'some', 'ridiculous', 'code', 'like', 'this', 'in', 'the', 'wild'] else False"
1000000 loops, best of 3: 0.264 usec per loop
$ python -m timeit "x=True if 'my_variable' in ('a', 'much', 'longer', 'list', 'of', 'choices', 'but', 'still', 'nothing', 'crazy', 'and', 'perhaps', 'you', 'could', 'actually', 'find', 'some', 'ridiculous', 'code', 'like', 'this', 'in', 'the', 'wild') else False"
1000000 loops, best of 3: 0.262 usec per loop
$ python -m timeit "x=True if 'my_variable' in {'a', 'much', 'longer', 'list', 'of', 'choices', 'but', 'still', 'nothing', 'crazy', 'and', 'perhaps', 'you', 'could', 'actually', 'find', 'some', 'ridiculous', 'code', 'like', 'this', 'in', 'the', 'wild'} else False"
1000000 loops, best of 3: 0.82 usec per loop
Tuples and Lists perform the same, and they are clearly faster than sets. I would imagine this is because the sets come with a lot more overhead and thus aren't as practical when N is small. For lots more performance related information comparing tuples and lists, see the various answers on Are tuples more efficient than lists in Python?
As for style, I don't think there is really any difference.