CKTIS / Python
all()
Tests successive elements for truth and stops at the first falsy item.
Version: Python 3.14; repository image, production runtime not attested
Syntax
all(iterable, /)Tests successive elements for truth and stops at the first falsy item.
An empty iterable satisfies the test because there is no failing element.
Truth testing stops at the first false value. Four passes, zero fails, and the final 2 need not be consumed. The result is a Boolean. With no elements there is no counterexample, so the result for an empty input is True.
it = iter([4, 0, 2])
assert all(it) is False and next(it) == 2
assert all([]) is True
Examples
print(all([4, 0, 2]))
print(all([]))
Result
False True
Truth testing stops at the first false value. Four passes, zero fails, and the final 2 need not be consumed. The result is a Boolean. With no elements there is no counterexample, so the result for an empty input is True.