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

Guido van Rossum guido at python.org
Tue Apr 12 21:59:10 EDT 2016


On Tue, Apr 12, 2016 at 6:42 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> 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.

How would you implement it though? There are gaps in the hash table.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-ideas mailing list