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/063682.html below:

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

[Python-Dev] Any reason that any()/all() do not take a predicate argument?Georg Brandl g.brandl at gmx.net
Thu Apr 13 10:10:42 CEST 2006
Mikhail Glushenkov wrote:
> 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):
> ...

Well, does

if any(x == 5 for x in seq)

meet your needs?

Georg

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