[Python-ideas] statistics.sum [was Re: Pre-PEP: adding a statistics module to Python]

Andrew Barnert abarnert at yahoo.com
Tue Aug 6 05:11:38 CEST 2013


On Aug 5, 2013, at 16:46, Nick Coghlan <ncoghlan at gmail.com> wrote:

> Note: one advantage of calling the new module math.statistics is that it leaves the door open to a possible future cmath.statistics, since there *are* some statistical operations that make sense with complex numbers, too)

Actually, a _lot_ of the operations make sense with complex numbers--sum and mean, most obviously. Even sum of squares, variance, stdev, etc. have unambiguous meanings, even if they're not as obviously useful.

So... What happens if you call them on complex numbers. (I'd be happy with either "it works when it makes sense" or "TypeError", I'm just curious which.)

Anyway, +1 on the overall idea, +0.5 on the simple name "sum", and I guess +0 or -0 on making it math.statistics instead of just statistics depending on the answer to the previous question.


More information about the Python-ideas mailing list