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

David Heiberg report at bugs.python.org
Sun May 10 05:06:35 EDT 2020


David Heiberg <dhdavvie at gmail.com> added the comment:

Ahh I see, thanks for clearing that up!

On Sun, May 10, 2020, 04:41 Raymond Hettinger <report at bugs.python.org>
wrote:

>
> 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>
> _______________________________________
>

----------

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


More information about the Python-bugs-list mailing list