[issue46190] Omit k in random.sample()
Raymond Hettinger
report at bugs.python.org
Wed Dec 29 02:04:54 EST 2021
Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:
If all you want is a sample where k==1, then use choice(). That is clearer and more efficient.
The sample() function is for sampling without replacement which only makes sense when k > 1; otherwise, choice() or choices() is usually what you want.
----------
assignee: -> rhettinger
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46190>
_______________________________________
More information about the Python-bugs-list
mailing list