[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0
gaoxinge
report at bugs.python.org
Tue Oct 29 23:06:29 EDT 2019
gaoxinge <gaoxx5 at gmail.com> added the comment:
I think that three kinds of mean should behave like:
- `geometric mean`: input should be float, finite and positive
- `harmonic mean`: input should be float, finite and nonzero
- `mean` or `fmean`: input should be float, finite
Otherwise these mean functions should raise a `StatisticsError`.
Two points that we should pay attention to:
- Why every input should be float? Because it is a statstics library, we should focus on the float instead of complex number or string or `math.nan`.
- Why every input shoud be finite? Becuse we should get rid of `math.inf`.
----------
nosy: +gaoxinge
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38382>
_______________________________________
More information about the Python-bugs-list
mailing list