Python version of C++ all_of

built-in, c++, python

Solution

`all` is a builtin:

all(predicate(e) for e in iterable)

I don't think it is worth it to define something like this:

def all_of(iterable, predicate):
    return all(predicate(e) for e in iterable)

Problem

Is there any better way (using built-in functions) to rewrite the following piece of code: ``` def all_of(iterable, predicate): for elem in iterable: if not predicate(elem): return False return True ```

Original source