In that case, I usually use any
if not any((foo == '1', bar == '2', baz == '3')):
print 'Invalid'
any returns True as soon as one of the conditions in the provided iterable is True. So it is like a list of or but is way easier to manage, especialy when you start having a combination of values to verify and nots.
You should use any, next, all,… these are really powerful and useful buit-in helpers.
0
solved Combining if with not and or [closed]