[Python-ideas] Fast sum() for non-numbers
Oscar Benjamin
oscar.j.benjamin at gmail.com
Thu Jul 11 13:05:58 CEST 2013
On 11 July 2013 11:47, Ron Adam <ron3200 at gmail.com> wrote:
>
> I would like sum to (eventually) be moved to the math module and have it's
> API and behaviour be the same as fsum. That would have the least surprises
> and it reduces the mental load when two similar functions act the same and
> can be found near each other in the library.
Sum is *really* useful. You can use it for ints, for floats, for numpy
arrays, for Decimals, for Fractions, for sympy.Expressions, for
gmpy2...
math.fsum is only useful for scalar floats but sum does so much more.
There's no need to cripple it just just to stop people from summing
lists.
Oscar
More information about the Python-ideas
mailing list