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: math.prod can return integers (contradicts doc)
Type: behavior Stage:
Components: Documentation Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: docs@python, neilwebber, rhettinger
Priority: low Keywords:

Created on 2022-02-22 19:04 by neilwebber, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg413741 - (view) Author: Neil Webber (neilwebber) Date: 2022-02-22 19:04
The math module documentation says:

   Except when explicitly noted otherwise, all return values are floats.

But this code returns an integer:

   from math import prod; prod((1,2,3))

Doc should "explicitly note otherwise" here, I imagine. The issue being wanting to know that the result on all-integer input will be an exact (integer) value not a floating value.
msg413763 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2022-02-23 01:41
I'll add a note that the output type is determined by the input type.
History
Date User Action Args
2022-04-11 14:59:56adminsetgithub: 90984
2022-02-23 01:41:08rhettingersetpriority: normal -> low

nosy: + rhettinger
messages: + msg413763

assignee: docs@python -> rhettinger
2022-02-22 19:04:33neilwebbercreate