[Python-checkins] bpo-37624: Document weight assumptions for random.choices() (GH-14855) (GH-14858)

Raymond Hettinger webhook-mailer at python.org
Fri Jul 19 05:17:39 EDT 2019


https://github.com/python/cpython/commit/a50a6225a06e5a83ce2a880a7eb4496043fdbb55
commit: a50a6225a06e5a83ce2a880a7eb4496043fdbb55
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Raymond Hettinger <rhettinger at users.noreply.github.com>
date: 2019-07-19T02:17:21-07:00
summary:

bpo-37624: Document weight assumptions for random.choices() (GH-14855) (GH-14858)

(cherry picked from commit 8dbe563aa6bd18b8c581951537dfb406d36e8063)

Co-authored-by: Raymond Hettinger <rhettinger at users.noreply.github.com>

files:
M Doc/library/random.rst

diff --git a/Doc/library/random.rst b/Doc/library/random.rst
index fcedba4dbc20..90b86248e6e1 100644
--- a/Doc/library/random.rst
+++ b/Doc/library/random.rst
@@ -160,7 +160,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).
+   integers, floats, and fractions but excludes decimals).  Weights are
+   assumed to be non-negative.
 
    For a given seed, the :func:`choices` function with equal weighting
    typically produces a different sequence than repeated calls to



More information about the Python-checkins mailing list