[Python-ideas] Allow random.choice, random.sample to work on iterators
Bernardo Sulzbach
mafagafogigante at gmail.com
Wed Nov 30 16:51:08 EST 2016
On 2016-11-30 19:11, Chris Kaynor wrote:
>
> All that said, I would not be opposed to Python including a
> random.reservoir_choice (probably not the best name) function *in
> addition* to random.choice. The algorithm has its uses, but enough
> drawbacks and gotchas that it likely is not a good candidate for a
> fallback.
I think this may be the path of least resistance for this. Even if this
does imply one or two new functions in random, it may be better than
changing random.choice.
If these functions would be used enough by enough end users to justify
this change is debatable, however.
--
Bernardo Sulzbach
http://www.mafagafogigante.org/
mafagafogigante at gmail.com
More information about the Python-ideas
mailing list