[Python-ideas] About adding a new iterator methodcalled"shuffled"
python at rcn.com
Tue Mar 24 23:20:39 CET 2009
> Note that using sorting to shuffle is likely very inefficient.
Who cares? The OP's goal was to save a few programmer
clock cycles so he could in-line what we already get from
random.shuffle(). His request is use case challenged
(very few programs would benefit and those would only
save a line or two). If he actually cares about O(n) time
then it's trivial to write:
s = list(iterable)
for elem in s:
. . .
But if he want's to mush it on one-line, I gave a workable
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas