[Python-ideas] Parametrized any() and all() ?
Masklinn
masklinn at masklinn.net
Wed Jan 16 12:08:55 CET 2013
On 2013-01-16, at 11:44 , Tarek Ziadé wrote:
> On 1/16/13 11:33 AM, Laurens Van Houtven wrote:
>> Hey Tarek,
>>
>> I would write that as any(x is None for x in it)
>
> But here you're building yet another iterable to adapt it to any(), which seems to me overkill if we can just parametrized the loop in any()
It's just a generator, and will be terminated early if possible.
I'm pretty sure adding a key function to any and all has already been
submitted several times, and from what I remember it was struck down
every time because the use case is covered by Laurens's suggestion: key
functions are necessary when you'd otherwise need DSU (because the
result is the original input, not the key function's output) but it's
not the case for any() and all()
Here's the previous/latest instance: http://mail.python.org/pipermail/python-ideas/2012-July/015837.html
More information about the Python-ideas
mailing list