On Apr 3, 8:44 am, Ant <[EMAIL PROTECTED]> wrote:
> On Apr 3, 12:37 pm, [EMAIL PROTECTED] wrote:
>
> > What's the neatest and/or most efficient way of testing if one of a
>
> A different approach:
>
> >>> words = ["he", "sh", "bla"]
> >>> name = "blah"
> >>> True in (word in name for word in words)
>
> True
>
> >>> name = "bling"
> >>> True in (word in name for word in words)
>
> False
>
> Perhaps not as obvious or readable as Jeff's example, but is
> essentially doing the same thing using generator syntax.

That's pretty :)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to