This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add a product() function to the standard library
Type: enhancement Stage:
Components: Versions: Python 3.6
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Utkan Gezer, abarry, mark.dickinson, rhettinger, steven.daprano
Priority: normal Keywords:

Created on 2016-07-02 11:40 by Utkan Gezer, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (6)
msg269706 - (view) Author: Utkan Gezer (Utkan Gezer) Date: 2016-07-02 11:40
An issue of enhancement by the introduction of a built-in product() function for the multiplication operation, functions similar to how sum does for the addition operation.

This issue is a reincarnation of Issue 1093 for Python 2.6, now for 3.6.

Ref: http://bugs.python.org/issue1093
msg269707 - (view) Author: Anilyka Barry (abarry) * (Python triager) Date: 2016-07-02 11:57
What is the use case, and why is a regular for loop not enough? The bar for adding new builtin functions is high, and I don't think this meets it.
msg269708 - (view) Author: Utkan Gezer (Utkan Gezer) Date: 2016-07-02 12:11
The use case is similar to the use case of sum() function, which is analogous to the sigma notation in mathematics, and is analogous to the use case of the pi notation in mathematics.

Regular loop should be equally enough to achieve the function of sum(), yet the sum() exists. Only apparent (to me) difference between the sum() and product() is that sum() is already built-in while product() is yet to be.
msg269709 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2016-07-02 12:26
On Sat, Jul 02, 2016 at 11:40:48AM +0000, Utkan Gezer wrote:
> 
> New submission from Utkan Gezer:
> 
> An issue of enhancement by the introduction of a built-in product() 
> function for the multiplication operation, functions similar to how 
> sum does for the addition operation.

I will likely be introducing an internal product() to the statistics 
module, for use in calculating the geometric mean. 

The problem with product() is similar to the problem with sum(). There 
are three different implementations of sum in the std lib: a general 
purpose one optimised for speed as the builtin, one optimized for 
floating point accuracy in the math module, and an internal-only private 
one optimized for exactness in the statistics module. I expect that 
product() will have the same tradeoffs, only even more so since it will 
overflow much more easily than sum() will.
msg269710 - (view) Author: Anilyka Barry (abarry) * (Python triager) Date: 2016-07-02 12:36
With the existence of multiple sum() functions (and potentially multiple product() functions), would it be worth it to group these all into one module? It also doesn't help that there is an itertools.product function that has yet another purpose.

I maintain my stance that this doesn't meet the bar for entry in the builtins, but adding this to the stdlib is much more reasonable (and likely).
msg269732 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-07-02 20:14
Actually, Guido already vetoed the idea: http://bugs.python.org/issue1093
History
Date User Action Args
2022-04-11 14:58:33adminsetgithub: 71626
2016-07-04 14:15:28mark.dickinsonsetnosy: + mark.dickinson
2016-07-02 20:14:11rhettingersetstatus: open -> closed

nosy: + rhettinger
messages: + msg269732

resolution: rejected
2016-07-02 12:36:35abarrysetmessages: + msg269710
title: product function patch -> Add a product() function to the standard library
2016-07-02 12:26:03steven.dapranosetnosy: + steven.daprano
messages: + msg269709
2016-07-02 12:11:18Utkan Gezersetmessages: + msg269708
2016-07-02 11:57:31abarrysetnosy: + abarry
messages: + msg269707
2016-07-02 11:40:48Utkan Gezercreate