mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
bpo-35606: Implement math.prod (GH-11359)
This commit is contained in:
parent
e9bc4172d1
commit
bc09851586
6 changed files with 260 additions and 1 deletions
|
|
@ -178,6 +178,18 @@ Number-theoretic and representation functions
|
|||
of *x* and are floats.
|
||||
|
||||
|
||||
.. function:: prod(iterable, *, start=1)
|
||||
|
||||
Calculate the product of all the elements in the input *iterable*.
|
||||
The default *start* value for the product is ``1``.
|
||||
|
||||
When the iterable is empty, return the start value. This function is
|
||||
intended specifically for use with numeric values and may reject
|
||||
non-numeric types.
|
||||
|
||||
.. versionadded:: 3.8
|
||||
|
||||
|
||||
.. function:: remainder(x, y)
|
||||
|
||||
Return the IEEE 754-style remainder of *x* with respect to *y*. For
|
||||
|
|
|
|||
|
|
@ -171,6 +171,15 @@ json.tool
|
|||
Add option ``--json-lines`` to parse every input line as separate JSON object.
|
||||
(Contributed by Weipeng Hong in :issue:`31553`.)
|
||||
|
||||
|
||||
math
|
||||
----
|
||||
|
||||
Added new function, :func:`math.prod`, as analogous function to :func:`sum`
|
||||
that returns the product of a 'start' value (default: 1) times an iterable of
|
||||
numbers. (Contributed by Pablo Galindo in :issue:`issue35606`)
|
||||
|
||||
|
||||
os.path
|
||||
-------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue