[issue40569] Add optional weights to random.sample()

Raymond Hettinger report at bugs.python.org
Sat May 9 23:41:56 EDT 2020


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

Negative weights are undefined for choices() as well.  Just like bisect() and merge() don't verify their inputs are sorted.  Usually, full scan precondition checks are expensive in pure python and aren't worth penalizing correct code. As Henk-Jaap points-out, negative weights are just a special case of meaningless inputs.

----------

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


More information about the Python-bugs-list mailing list