[issue33494] random.choices ought to check that cumulative weights are in ascending order

Raymond Hettinger report at bugs.python.org
Sun May 27 13:58:56 EDT 2018


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> or, for a minimal doc change, change this sentence:
> "For example, the relative weights [10, 5, 30, 5] are 
> equivalent to the cumulative weights [10, 15, 45, 50],"
>
> to:
> "For example, the relative call 'weights[10, 5, 30, 5]' 
> is equivalent to the cumulative call 'cum_weights[10, 15, 45, 50]',"

Sorry, that doesn't seem like an improvement at all to me.  Adding "call" just makes the sentence read awkwardly.

Also, this week I did some user testing on the existing docs and didn't find a single case of misreading what "cumulative weights" meant.

I'm marking this as closed.  The suggestion was appreciated but adding additional input checks would defeat the entire purpose of the feature.  The user testing suggest that the docs are okay as-is (and there are additional examples in the recipes section below).

----------
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list