
On Tue, Apr 27, 2010 at 6:55 PM, Ilya Shlyakhter <ilya_shl@alum.mit.edu> wrote:
A suggestion: extend math.fsum to accept an iterable that yields tuples of floats, and returns a tuple of sums. This would permit summing multiple running sums at once (e.g. keeping both a sum and a sum-of-squares for computing standard deviation from an iterable), or summing a stream of complex numbers.
An alternative would be to make an object-oriented version of fsum that has a method for adding a number to the sum; then an array of such objects could be used to sum multiple iterables simultaneously.
It's an interesting idea. The second alternative appeals to me more than the first: I could see other uses for being able to pass a partial sum state around. Mark