diff options
author | Ram Rachum <ram@rachum.com> | 2020-09-29 01:32:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-29 01:32:10 (GMT) |
commit | b0dfc7581697f20385813582de7e92ba6ba0105f (patch) | |
tree | 56cb713f1bf2d302363b133682e5ad4afa1e739e /Doc | |
parent | e8acc355d430b45f1c3ff83312e72272262a854f (diff) | |
download | cpython-b0dfc7581697f20385813582de7e92ba6ba0105f.zip cpython-b0dfc7581697f20385813582de7e92ba6ba0105f.tar.gz cpython-b0dfc7581697f20385813582de7e92ba6ba0105f.tar.bz2 |
bpo-41773: Raise exception for non-finite weights in random.choices(). (GH-22441)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/random.rst | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/random.rst b/Doc/library/random.rst index 0cdf0a6..af5131d 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -180,8 +180,8 @@ Functions for sequences The *weights* or *cum_weights* can use any numeric type that interoperates with the :class:`float` values returned by :func:`random` (that includes - integers, floats, and fractions but excludes decimals). Behavior is - undefined if any weight is negative. A :exc:`ValueError` is raised if all + integers, floats, and fractions but excludes decimals). Weights are assumed + to be non-negative and finite. A :exc:`ValueError` is raised if all weights are zero. For a given seed, the :func:`choices` function with equal weighting |