[Python-Dev] product()

Raymond Hettinger raymond.hettinger at verizon.net
Wed Oct 22 21:43:05 EDT 2003

In the course of writing up Pep 289, it became clear that
the future has a number of accumulator functions in store.
Each of these is useful with iterators of all stripes and
each helps eliminate a reason for using reduce().

Some like average() and stddev() will likely end up in a 
statistics module.  Others like nbiggest(), nsmallest(),
anytrue(), alltrue(), and such may end-up somewhere else.

The product() accumulator is the one destined to be a builtin.

Though it is not nearly as common as sum(), it does enjoy
some popularity.  Having it available will help dispense
with reduce(operator.mul, data, 1).

Would there be any objections to my adding product() to
Py2.4?  The patch was simple and it is ready to go unless 
someone has some major issue with it.

Raymond Hettinger

More information about the Python-Dev mailing list