I am pretty sure there is a common idiom, but I couldn’t find it with Google Search…
Here is what I want to do (in Java):
// Applies the predicate to all elements of the iterable, and returns
// true if all evaluated to true, otherwise false
boolean allTrue = Iterables.all(someIterable, somePredicate);
How is this done “Pythonic” in Python?
Also would be great if I can get answer for this as well:
// Returns true if any of the elements return true for the predicate
boolean anyTrue = Iterables.any(someIterable, somePredicate);
Do you mean something like: