Closed MartinThoma closed 3 years ago
It's shorter.
# Bad for x in iterable: if check(x): return True return False # Good return any(check(x) for x in iterable)
# Bad for x in iterable: if check(x): return False return True # Good return all(check(x) for x in iterable)
Explanation
It's shorter.
Example 1: any
Example 2: all