[Python-ideas] random.choice on non-sequence

Ethan Furman ethan at stoneleaf.us
Tue Apr 12 18:21:11 EDT 2016

On 04/12/2016 02:53 PM, Guido van Rossum wrote:

> The problem with your version is that copying the input is slow if it is large.
> Raymond was referencing the top answer here:
> http://stackoverflow.com/questions/2394246/algorithm-to-select-a-single-random-combination-of-values.
> It's also slow though (draws N random values if the input is of length
> N).

So the objection is that because performance can vary widely it is 
better for users to select their own algorithm rather than rely on a 
one-size-fits-all stdlib solution?


More information about the Python-ideas mailing list