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.
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" <me@louie.lu> 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
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/