[issue41773] Clarify handling of infinity and nan in random.choices

Ram Rachum report at bugs.python.org
Sun Sep 13 05:30:30 EDT 2020


Ram Rachum <ram at rachum.com> added the comment:

Yes, but the docs say that the weights are assumed to be nonnegative. I'm assuming the check is done on total because it'd be expensive to do it on each item. A user reading that error message could understand that it's okay for weights to be negative as long as the total isn't, which as far as I understand isn't true.

----------

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


More information about the Python-bugs-list mailing list