A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-April/063760.html below:

[Python-Dev] Any reason that any()/all() do not take a predicateargument?

[Python-Dev] Any reason that any()/all() do not take a predicateargument? [Python-Dev] Any reason that any()/all() do not take a predicateargument?Brian Quinlan brian at sweetapp.com
Sat Apr 15 10:53:48 CEST 2006
>> 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)
> 
> How about this?
> 
> 	if any(x==5 for x in seq):

Aren't all of these equivalent to:

if 5 in seq:
     ...

?

Cheers,
Brian

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4