[issue40541] Add optional weights parameter to random.sample()

Mark Dickinson report at bugs.python.org
Thu May 7 07:34:58 EDT 2020


Mark Dickinson <dickinsm at gmail.com> added the comment:

+1 for the functionality.

How about "counts" instead of "weights"?

I found the name "weights" misleading - my first thought was that this would be doing a weighted sampling without replacement (like NumPy's `random.choice(..., replace=False, p=weights)`).

Of course, now I've read the docs, I know better.

----------

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


More information about the Python-bugs-list mailing list