selecting a random item from a set

Martin v. Loewis martin at
Wed Dec 31 00:30:43 CET 2003

Alexander Schmolck wrote:

> Is there a better way? If not, how about something like Set.randompop()?

In principle, random.choice "ought to" work. It doesn't, as it expects
the set to be indexable.

I would not like the Set type to grow random methods :-)


More information about the Python-list mailing list