[issue46190] Omit k in random.sample()

Tilman Krummeck report at bugs.python.org
Wed Dec 29 00:36:37 EST 2021


New submission from Tilman Krummeck <tilman.krummeck at googlemail.com>:

random.sample can be used to choose k items from a given sequence. Currently, k is a mandatory parameter. 

I suggest to make k optional and instead, if omitted, pick a random value from the range of 0 and the length of the sequence.

Of course, doing this must also consider any possible value of 'count'

----------
components: Extension Modules
messages: 409283
nosy: TilmanKrummeck
priority: normal
severity: normal
status: open
title: Omit k in random.sample()
type: enhancement

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


More information about the Python-bugs-list mailing list