Author WarrenWeckesser
Recipients WarrenWeckesser
Date 2019-10-06.02:40:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The premature return on ZeroDivisionError also causes an inconsistency in how types are handled.  For example,

>>> harmonic_mean([1, 0, "foo"])

We get an error as expected if "foo" occurs before 0:

>>> harmonic_mean([1, "foo", 0])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/warren/repos/git/forks/cpython/Lib/", line 406, in harmonic_mean
    T, total, count = _sum(1/x for x in _fail_neg(data, errmsg))
  File "/Users/warren/repos/git/forks/cpython/Lib/", line 166, in _sum
    for n,d in map(_exact_ratio, values):
  File "/Users/warren/repos/git/forks/cpython/Lib/", line 406, in <genexpr>
    T, total, count = _sum(1/x for x in _fail_neg(data, errmsg))
  File "/Users/warren/repos/git/forks/cpython/Lib/", line 288, in _fail_neg
    if x < 0:
TypeError: '<' not supported between instances of 'str' and 'int'
Date User Action Args
2019-10-06 02:40:20WarrenWeckessersetrecipients: + WarrenWeckesser
2019-10-06 02:40:20WarrenWeckessersetmessageid: <>
2019-10-06 02:40:20WarrenWeckesserlinkissue38382 messages
2019-10-06 02:40:20WarrenWeckessercreate