On Sun, Jul 22, 2012 at 9:03 PM, Giampaolo Rodolà <g.rod...@gmail.com> wrote:You're missing some brackets or parens there:
> This would be similar to 'key' argument already available for min(), max()
> and sorted() and would let user decide what must be considered True and what
> Some use cases:
> all(a, b, c, ... key=callable)
all([a, b, c, ...], key=callable)
> Thoughts?I see negligible advantage over just writing the generator expression directly:
all(callable(item) for item in iterable)
=== all(iterable, key=callable)
(which is about comparable to the difference between a map()
invocation vs. a list comprehension, and the choice there seems to be
largely a matter of taste)
min() & max() return the result object satisfying the constraint, so
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.