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

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

[Python-Dev] Any reason that any()/all() do not take apredicateargument? [Python-Dev] Any reason that any()/all() do not take apredicateargument?Raymond Hettinger raymond.hettinger at verizon.net
Sun Apr 16 05:26:43 CEST 2006
[Bill Janssen]
> Yeah, but you can't do more complicated expressions that way, like
>
>      any(lambda x: x[3] == "thiskey")

You're not making any sense.  The sequence argument is not listed and the lambda 
is unnecessary.  Try this instead:

     any(x[3] == 'thiskey' for x in seq)


> I think it makes a lot of sense for any and all to take optional
> predicate function arguments.

I think you don't understand what you already have to work with in Py2.5a -- a 
boolean expression in a genexp should always suffice -- no separate lambda based 
predicate function is ever required.


Raymond







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