[Python-ideas] [Python-Dev] About adding a new iterator methodcalled "shuffled"

Raymond Hettinger python at rcn.com
Tue Mar 24 17:03:31 CET 2009

> On Tue, Mar 24, 2009, Roy Hyunjin Han wrote:
>> I know that Python has iterator methods called "sorted" and "reversed" and
>> these are handy shortcuts.
>> Why not add a new iterator method called "shuffled"?

You can already write:

       sorted(s, key=lambda x: random())

But nobody does that.  So you have a good
indication that the proposed method isn't need.


More information about the Python-ideas mailing list