[Python-Dev] Any reason that any()/all() do not takea predicateargument? (original) (raw)
Andrew Koenig ark at acm.org
Tue May 2 19:55:03 CEST 2006
- Previous message: [Python-Dev] Positional-only Arguments
- Next message: [Python-Dev] mail to talin is bouncing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> 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 doesn't.
- Previous message: [Python-Dev] Positional-only Arguments
- Next message: [Python-Dev] mail to talin is bouncing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]