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

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Apr 12 21:42:41 EDT 2016


Guido van Rossum wrote:
> The problem with your version is that copying the input is slow if it is large.

Maybe sets should have a method that returns an indexable
view? The order could be defined as equivalent to iteration
order, and it would allow things like random.choice to
work efficiently on sets.

-- 
Greg



More information about the Python-ideas mailing list