[Python-ideas] a in x or in y
Carl Meyer
carl at oddbird.net
Thu Feb 13 00:55:09 CET 2014
On 02/12/2014 02:12 PM, Ram Rachum wrote:
> What do you think about adding this to Python:
>
> 'whatever a long string' in x or in y
>
> I've often wished for this because the current way is quite verbose:
>
> 'whatever a long string' in x or 'whatever a long string' in y
Except you'd never actually do that, you'd just put the long string in a
variable. Or the other option:
any('whatever a long string' in i for i in [x, y])
(And 'all' similarly covers the 'and' case.)
Carl
More information about the Python-ideas
mailing list