This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients cool-RR, rhettinger
Date 2020-09-28.20:04:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601323487.75.0.580042052322.issue41773@roundup.psfhosted.org>
In-reply-to
Content
I've discussed this with other developers and now agree that a test should be added.  While the current code's handing of Inf or NaN is correct in a technical sense, it is neither intuitive or useful.

Even though it will have a small time cost for the common case of two weights, we should add a test just after the check for the total being greater than zero:

    if not _isfinite(total):
        raise ValueError('Total of weights must be finite')

Also edit the docs to say:

   Weights are assumed to be non-negative and finite.

Ram, since this was your finding, do you want to make a PR for it (with a test, news entry, and doc edit)?
History
Date User Action Args
2020-09-28 20:04:47rhettingersetrecipients: + rhettinger, cool-RR
2020-09-28 20:04:47rhettingersetmessageid: <1601323487.75.0.580042052322.issue41773@roundup.psfhosted.org>
2020-09-28 20:04:47rhettingerlinkissue41773 messages
2020-09-28 20:04:47rhettingercreate