> choice() returns a random element from the list of choices, not its index. > One could call pop() instead of del, but del is probably a little faster, > and > doesn't return a value that we wouldn't use anyway. pop() wouldn't give > us a > random element, unless passed a random argument, such as > pop(choice(range(len(choices)))), but that would be very cumbersome.
I like the shuffle idea. n = [1,2,5,1,2,34,2,4,7,3,3,45,1,76,8] proxy = random.shuffle(xrange(len(n))) for idx in proxy: dowith(n[idx]) _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
