[docs] [issue37624] random.choices has unexpected behavior with negative weights
report at bugs.python.org
Fri Jul 19 05:27:50 EDT 2019
Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:
Misc side notes:
* There is no expected behavior for negative a negative weight. Arguably, the only reasonable interpretation is what it already does (reduce the cumulative total).
* Running simulations is a primary use case for choices(). Generally, running time there is important.
* During the design phase, none of the other implementations studied had incorporated a scan of the inputs for negative weights.
* bisect() does not check to make sure its inputs are sorted. The results for unsorted data are undefined. It is a documented precondition.
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
Python tracker <report at bugs.python.org>
More information about the docs