[Python-Dev] Any reason that any()/all() do not takea predicateargument?
ark at acm.org
Tue May 2 19:55:03 CEST 2006
> > How about this?
> > if any(x==5 for x in seq):
> Aren't all of these equivalent to:
> if 5 in seq:
Of course. However, the original example was pretty clearly intended to be
an illustrative instance of a more general problem. Rewriting the example
as any(x==5 for x in seq) preserves the generality; rewriting it as 5 in seq
More information about the Python-Dev