Finding a tuple in a tuple
Duncan Booth
duncan.booth at invalid.invalid
Fri Feb 23 08:23:23 EST 2007
Philipp Pagel <pDOTpagel at gsf.de> wrote:
> Another way to go instead of using sets, although probably less elegant:
>
>>>> True in [x in t1 for x in t2]
> True
>>>> True in [x in t1 for x in t3]
> True
>>>> True in [x in t1 for x in t4]
> False
>>>> True in [x in t1 for x in t5]
> False
Slightly more elegant for Python 2.5 users:
>>> any(x in t1 for x in t2)
True
>>> any(x in t1 for x in t3)
True
>>> any(x in t1 for x in t4)
False
>>> any(x in t1 for x in t5)
False
More information about the Python-list
mailing list