Any reason that any()/all() do not take a predicate argument?
13 Apr
2006
13 Apr
'06
2:43 a.m.
Hi, sorry if this came up before, but I tried searching the archives and found nothing. It would be really nice if new builtin truth functions in 2.5 took a predicate argument(defaults to bool), so one could write, for example: seq = [1,2,3,4,5] if any(seq, lambda x: x==5): ... which is clearly more readable than reduce(seq, lambda x,y: x or y==5, False) IIRC, something like that is called junctions in Perl 6.
6561
Age (days ago)
6580
Last active (days ago)
9 comments
7 participants
participants (7)
-
"Martin v. Löwis"
-
Andrew Koenig
-
Bill Janssen
-
Brian Quinlan
-
Georg Brandl
-
Mikhail Glushenkov
-
Raymond Hettinger