[New-bugs-announce] [issue35996] Optional modulus argument for new math.prod() function

Berry Schoenmakers report at bugs.python.org
Thu Feb 14 14:34:36 EST 2019


New submission from Berry Schoenmakers <l.a.m.schoenmakers at tue.nl>:

It's nice to see the arrival of the prod() function, see PR11359.

Just as for the built-in pow(x, y[, z]) function it would be very useful to have an optional argument z for computing integer products modulo z. Typical use case in cryptography would be:

prod((pow(x, y, z) for x, y in zip(g, s)), z)

to compute the product of all (potentially many) g[i]**s[i]'s modulo z. 

And, just as with the use of pow(), the intermediate values for prod() may in general grow quickly, hence modular reduction is essential to limit time and space usage.

Maybe an interesting option to add at this stage?

----------
components: Library (Lib)
messages: 335557
nosy: lschoe, rhettinger
priority: normal
severity: normal
status: open
title: Optional modulus argument for new math.prod() function
type: performance
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35996>
_______________________________________


More information about the New-bugs-announce mailing list