Why isn't there a built-in product()?

Michael F. Stemper michael.stemper at gmail.com
Thu Jul 7 14:26:51 EDT 2022


sum() is wonderful.

  >>> nums = [1,2,3]
  >>> sum(nums)
  6
  >>> product(nums)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  NameError: name 'product' is not defined
  >>>

I understand that there is no product() or prod(). Does anybody
here know why that was not included in the language? It seems
as if it would be useful, so there must have been some rationale
for that decision.

-- 
Michael F. Stemper
87.3% of all statistics are made up by the person giving them.


More information about the Python-list mailing list