This could be better:

>>> import random
>>> population = range(10)
>>> choice = random.choice(population)
>>> population.remove(choice)
>>> print population
>>> print population
[0, 1, 2, 3, 4, 5, 6, 8, 9]

That was my idea with the previous pop(), remove from the population a
certain number of elements at random.
In the docs pop is defined as:
 Remove and return an arbitrary element from the set.
My mistake: arbitrary is not the same as random :(

Mario


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to