[Python-Dev] product()

Michael Chermside mcherm at mcherm.com
Thu Oct 23 03:29:48 EDT 2003


[Raymond, recently]:
> 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.


Just wanted to bring you a blast from the past:
[http://mail.python.org/pipermail/python-dev/2003-April/034784.html]
[Alex Martelli:]
> I think I understand the worry that introducing 'sum' would be the start
> of a slippery slope leading to requests for 'prod' (I can't think of other
> bulk operations that would be at all popular -- perhaps bulk and/or, but
> I think that's stretching it).  But I think it's a misplaced worry in this 
> case.  "Adding up a bunch of numbers" is just SO much more common
> than "Multiplying them up" (indeed the latter's hardly idiomatic English,
> while "adding up" sure is), that I believe normal users (as opposed to
> advanced programmers with a keenness on generalization) wouldn't
> have any problem at all with 'sum' being there and 'prod' missing...

I have nothing to add... Alex said it much better than I could.

-- Michael Chermside




More information about the Python-Dev mailing list