PEP 289: universal and existential operators

Jeremy Fincher tweedgeezer at hotmail.com
Wed Nov 5 15:23:58 EST 2003


Alex Martelli <aleax at aleax.it> wrote in message news:<g88qb.418190$R32.13848636 at news2.tin.it>...
> I'm not sure what these calls are meant represent -- maybe an
> interface similar to filter, i.e. a callable then a sequence?
> The functions we're considering, whatever their names, would
> in any case just take an iterator, so, e.g.:
> 
> if all(x.isupper() for x in line.split()):
> 
> and the like.

Yeah, I suppose that is the case :)  I was stuck in FP mode (and
without-generator-expressions mode; I use those two functions in my
own code all the time)

> I'll pass on that.  Maybe.  I think I still prefer alltrue and anytrue...

I'm afraid those names would inspire people to write code like this:

alltrue(bool(x) for x in someIterable)

I think the "true" in the function names might make people think it
constrains the type to be a bool, which, if it resulted in code as
above, would definitely be unfortunate.

Jeremy




More information about the Python-list mailing list