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

Neil Girdhar mistersheik at gmail.com
Tue Aug 1 22:48:58 EDT 2017



On Tuesday, August 1, 2017 at 12:58:24 PM UTC-4, Clément Pit-Claudel wrote:
>
> On 2017-08-01 17:28, Nick Coghlan wrote:
> > Right, the main correspondence here is with "sum()": folks can't write
> > "sum(a, b, c)", but they can write "a + b + c".
> > 
> > The various container constructors are also consistent in only taking
> > an iterable, with multiple explicit items being expected to use the
> > syntactic forms (e.g. [a, b, c], {a, b, c}, (a, b, c))
> > 
> > The same rationale holds for any() and all(): supporting multiple
> > positional arguments would be redundant with the existing binary
> > operator syntax, with no clear reason to ever prefer one option over
> > the other.
>
> Isn't there a difference, though, insofar as we don't have a '+/sum' or 
> 'and/all' equivalent of [a, b, *c]?
> You need to write 1 + 3 + sum(xs), or a and b and all(ys).  Or, of course, 
> any(chain([a], [b], c)), but that is not pretty.
>

a or b or any(c)

seems clear to me.
 

> Clément.
> _______________________________________________
> Python-ideas mailing list
> Python... at python.org <javascript:>
> 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/f6bc46a8/attachment.html>


More information about the Python-ideas mailing list