[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

Steven D'Aprano report at bugs.python.org
Wed Oct 30 04:09:46 EDT 2019


Steven D'Aprano <steve+python at pearwood.info> added the comment:

Have you read the rest of the thread? There is a compelling reason to 
support harmonic mean including zero (resistors in parallel) but not yet 
any compelling reason to support negative values.

If you have a good use-case for harmonic mean of negative values, please 
tell us. Until then, I agree with Raymond: negative values should be 
treated as an error, as documented.

Can we go back to the original issue? Should we just document the 
"early out" behaviour on hitting zero, or should we follow the 
suggestion to check for bad data and raise?

I'm currently undecided which I would prefer.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38382>
_______________________________________


More information about the Python-bugs-list mailing list