Efficient way of testing for substring being one of a set?

Ant antroy at gmail.com
Thu Apr 3 10:49:20 EDT 2008


On Apr 3, 2:27 pm, George Sakkis <george.sak... at gmail.com> wrote:
...
> It's even prettier in 2.5:
>
> any(word in name for word in words)
>
> George

And arguably the most readable yet!



More information about the Python-list mailing list