aleaxit at yahoo.com
Fri Sep 24 08:28:20 CEST 2004
Raymond Hettinger <vze4rx4y at verizon.net> wrote:
> [Michele Simionato]
> > 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.
> Random thoughts on itertools recipes and module design:
[snipped lots of valuable considerations]
and one more, specific thing...: 'any' and 'all', like (say) other
potentially useful functions such as count, average, etc, are
_accumulators_ -- they _consume_ an iterator, producing a 'scalar'
itertools is about filters and producers -- calling itertools.whatever
_returns_ an iterator.
I'd like a small module of accumulators. But putting accumulators into
itertools is the wrong placing. A general rule that helps users
remember what-goes-where, such as 'itertools stuff returns iterators',
is too precious to throw away lightly, IMHO.
More information about the Python-list