[Python-ideas] Provide a 'key' argument for all() and any() builtins
Raymond Hettinger
raymond.hettinger at gmail.com
Mon Jul 23 06:36:28 CEST 2012
On Jul 22, 2012, at 11:03 PM, Giampaolo RodolĂ wrote:
> 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 not.
There's no need. We already have:
>>> all(predicate(x) for x in iterable)
>>> any(predicate(x) for x in iterable)
Raymond
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120722/9c380f04/attachment.html>
More information about the Python-ideas
mailing list