Next / Previous / Contents / Shipman's homepage

20.3. any(): Are any of the members of an iterable true?

This function, applied to some iterable, is a predicate that tests whether any of the elements of that iterable are True. If any element is not already type bool, it is converted to a Boolean value using the bool() built-in function.

>>> noneTrue = (0, 0.0, (), None)
>>> any(noneTrue)
>>> someTrue = (0, 0.0, (88,), 'penguin')
>>> any(someTrue)