for_some(), for_all()?
Michele Simionato
michele.simionato at gmail.com
Thu Sep 23 09:40:47 EDT 2004
"Raymond Hettinger" <vze4rx4y at verizon.net> wrote in message news:<2Pt4d.5569$sa.1897 at trndny05>...
> >
> > http://www.python.org/doc/current/lib/itertools-example.html
> >
> > >>> 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