Problem using Random

Martin von Loewis loewis at informatik.hu-berlin.de
Sun Oct 28 05:01:30 EST 2001


"Terry Reedy" <tjreedy at home.com> writes:

> Removing items from near the front of a long list takes time.  *If*
> this matters, the following should be faster (when <pseudocode>
> translated to Python):

My recommendation would be

mylist = ['a','b','c','d','e','f']
random.shuffle(mylist)
for i in mylist:
  print i

Regards,
Martin



More information about the Python-list mailing list