Tim Peters <t...@python.org> added the comment:

I'd like to divorce `prod()` from floating-point complications.  The `sum()` 
builtin has proved extremely handy, even for floats, in large part because it's 
type-agnostic and straightforward.  While I'd usually use `prod()` on ints and 
Fractions, in almost all cases I have for multiplying floats a dirt simple 
implementation would work fine too (e.g., I don't multiply NaNs or infinities 
to begin with, overflow and underflow can't occur in context, and I usually 
couldn't care less about the accuracy of the trailing bits).

Not that floats should suffer benign neglect forever, but heroically complex - 
and expensive - float implementations should get their own function, like 
`fprod()` (like they got their own `fsum()` function).  Likewise if, e.g., 
someone wants an `iprod()` that makes heroic efforts to reorder partial 
products to speed multiplying sequences of giant integers, or `matprod()` to 
re-associate matrix multiplications in an optimal way, or ...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35606>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to