This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add random.shuffled
Type: enhancement Stage: needs patch
Components: Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: rhettinger, steven.daprano, tim.peters
Priority: normal Keywords:

Created on 2016-09-06 02:35 by steven.daprano, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg274504 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2016-09-06 02:35
An occasionally requested feature is for a shuffled() function, related to the in-place random.shuffle() as sorted() is to list.sort().

See the latest example:

https://mail.python.org/pipermail/python-ideas/2016-September/042096.html
msg274506 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2016-09-06 02:57
I'm at best -0 on the idea:  very easy to get the effect without it, and hard to imagine it's needed frequently.  `sorted()` is also very easy to mimic, but is used often by all sorts of code.  For example, to display output in a `for key in sorted(dict):` loop, or to create a throwaway sorted list for testing, like:

assert data2[low: high] == sorted(data[low: high])

In my own code, I find hundreds of uses of `sorted()`, but only a few dozen of `random.shuffle()`, and in none of the latter cases would `shuffled()` have been useful.
msg274507 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-09-06 03:03
Sorry Steven, I concur with Tim and am going to reject this one.
History
Date User Action Args
2022-04-11 14:58:35adminsetgithub: 72151
2016-09-06 03:03:44rhettingersetstatus: open -> closed
resolution: rejected
messages: + msg274507
2016-09-06 02:57:31tim.peterssetnosy: + tim.peters
messages: + msg274506

type: enhancement
stage: needs patch
2016-09-06 02:35:12steven.dapranocreate