for_some(), for_all()?

Michele Simionato michele.simionato at
Thu Sep 23 15:40:47 CEST 2004

"Raymond Hettinger" <vze4rx4y at> wrote in message news:<2Pt4d.5569$sa.1897 at trndny05>...
> >
> >
> >
> >  >>> import itertools, timeit, operator
> >  >>> def any(seq, pred=bool):
> > ...     "Returns True if pred(x) is True at least one element in the
> > iterable"
> > ...     return True in imap(pred, seq)
> I chose that one for the docs because it gave the best balance of clarity and
> speed.

I always wondered why "any" and "all" are given as recipes but are not
part of the itertools module. What is the rationale? 
I think they are so common that they deserve to be in the module.
At least, we would have standard names.

                     Michele Simionato

More information about the Python-list mailing list