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

2017-08-02 Thread Nick Coghlan
On 2 August 2017 at 02:57, Clément Pit-Claudel wrote: > On 2017-08-01 17:28, Nick Coghlan wrote: >> 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

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

2017-08-01 Thread Neil Girdhar
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

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

2017-08-01 Thread Terry Reedy
On 8/1/2017 9:01 AM, Louie Lu wrote: 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 To me, two APIs is a nuisance. For one thing, default

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

2017-08-01 Thread Lucas Wiman
On Tue, Aug 1, 2017 at 6:01 AM, Louie Lu wrote: > [...] > I'm not sure if this is discuss before, but can "any" and "all" > support like min_max "arg1, arg2, *args" style? > Can this be done consistently? For example consider x=[[]]. Then all(x) where x is interpreted as an

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

2017-08-01 Thread Clément Pit-Claudel
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

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

2017-08-01 Thread Nick Coghlan
On 1 August 2017 at 23:24, Paul Moore wrote: > On 1 August 2017 at 14:01, Louie Lu wrote: >> I'm not sure if this is discuss before, but can "any" and "all" >> support like min_max "arg1, arg2, *args" style? > > I don't see any particular reason why not, but

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

2017-08-01 Thread Nick Coghlan
On 1 August 2017 at 23:43, Ned Batchelder wrote: > 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... :) While I'm not sure how

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

2017-08-01 Thread Ned Batchelder
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"

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

2017-08-01 Thread Markus Meskanen
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" kirjoitti: Hi all, In "min" and "max" builtin-func, it support two style of args: min(...)

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

2017-08-01 Thread Paul Moore
On 1 August 2017 at 14:01, Louie Lu wrote: > I'm not sure if this is discuss before, but can "any" and "all" > support like min_max "arg1, arg2, *args" style? I don't see any particular reason why not, but is there a specific use case for this or is it just a matter of

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

2017-08-01 Thread Louie Lu
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