[Python-ideas] "any" and "all" support multiple arguments

Markus Meskanen markusmeskanen at gmail.com
Tue Aug 1 09:32:38 EDT 2017


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 at 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 at python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170801/f8b6afaf/attachment.html>


More information about the Python-ideas mailing list