[Python-ideas] all(iterable) should be like all(iterable, key=func)

shiva prasanth kesavarapu.siva at gmail.com
Sun Aug 23 08:31:57 CEST 2015


functionality of all(iter) is to check all are true by converting it to
boolean type

if it is changed to all(iterable,key=lambda a:bool(a)) it still works and

we can also do  a lot of things like
all([2,3,4],key=lamdba a:a) gives false
above checks all are equal or not
all([2,2,2],key=lambda a:a) gives true
abouve checks all are equal or not
all([1,2,4,9,key=lambda a:math.sqrt(a)**2==a])

and any(iter) should be changed as well
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150823/5346c0bb/attachment.html>


More information about the Python-ideas mailing list