[Python-ideas] Provide a 'key' argument for all() and any() builtins (original) (raw)
Raymond Hettinger raymond.hettinger at gmail.com
Mon Jul 23 06:36:28 CEST 2012
- Previous message: [Python-ideas] Provide a 'key' argument for all() and any() builtins
- Next message: [Python-ideas] Provide a 'key' argument for all() and any() builtins
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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>
- Previous message: [Python-ideas] Provide a 'key' argument for all() and any() builtins
- Next message: [Python-ideas] Provide a 'key' argument for all() and any() builtins
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]