[Python-Dev] Retrieve an arbitrary element from a set withoutremoving it
steve at pearwood.info
Wed Nov 4 12:00:49 CET 2009
On Wed, 4 Nov 2009 10:10:30 am Guido van Rossum wrote:
> On Tue, Nov 3, 2009 at 2:46 PM, Steven D'Aprano <steve at pearwood.info>
> > Since I was the person who decided that "arbitrary" meant "give a
> > different result each time", I should answer that.
> You're obviously talking about a *random* element. This is a separate
> use case (though I agree many people don't know the difference).
I'm aware of the difference between random and arbitrary, and in an
earlier post I said that the One Obvious Way of getting a random
element from a list would be to convert to a list and call
random.choice(). Sorry for muddying the waters by linking to a page
discussing such random selections.
More information about the Python-Dev