I find it frustrating that they always return booleans.  It would be
more useful if any() returned the first true value it finds.  This seems
like a backward-compatible-enough change to me... :)

--Ned.


On 8/1/17 9:32 AM, Markus Meskanen wrote:
> I'd be more interested in supporting the "key" function:
>
> any(users, key=User.is_admin)
>
> As opposed to:
>
> any(user.is_admin() for user in users)
>
> 1.8.2017 16.07 "Louie Lu" <[email protected] <mailto:[email protected]>> kirjoitti:
>
>     Hi all,
>
>     In "min" and "max" builtin-func, it support two style of args:
>
>         min(...)
>             min(iterable, *[, default=obj, key=func]) -> value
>             min(arg1, arg2, *args, *[, key=func]) -> value
>
>     But for "any" and "all", it only support iterable:
>
>         all(iterable, /)
>             Return True if bool(x) is True for all values x in the
>     iterable.
>
>
>     I'm not sure if this is discuss before, but can "any" and "all"
>     support like min_max "arg1, arg2, *args" style?
>
>
>     Thanks,
>     Louie.
>     _______________________________________________
>     Python-ideas mailing list
>     [email protected] <mailto:[email protected]>
>     https://mail.python.org/mailman/listinfo/python-ideas
>     <https://mail.python.org/mailman/listinfo/python-ideas>
>     Code of Conduct: http://python.org/psf/codeofconduct/
>     <http://python.org/psf/codeofconduct/>
>
>
>
>
> _______________________________________________
> Python-ideas mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to