[Tutor] Testing Membership in a Sequence
Christian Wyglendowski
Christian.Wyglendowski at greenville.edu
Mon Mar 15 17:42:17 EST 2004
Ok, here is a question that I thought I knew the answer to and even
vaguely remember discussing somewhere, but now I don't have the foggiest
(and I was unable to bend google to do my bidding).
What is the most pythonic way to test for membership of multiple items
in a sequence? For example:
x = ['a', 'b', 'c']
<pseudo code>
is ('v' or 'b') in x
</pseudo code>
I know I can do it via a loop but I was hoping to learn some nice,
clear, succinct way of doing this. Am I hoping for too much?
Christian
http://www.dowski.com
More information about the Tutor
mailing list