If so, then I would suggest than each list provides a .shuffle method as well (just as sorted/sort does).

On 06.09.2016 06:34, Mahmoud Hashemi wrote:
I tend to agree with Arek. I've been bitten multiple times, including once yesterday, because shuffle works in place, when I really expect a sorted()-like behavior for a standalone function like that.

Mahmoud
https://github.com/mahmoud
http://sedimental.org

On Mon, Sep 5, 2016 at 6:59 PM, Arek Bulski <arek.bul...@gmail.com <mailto:arek.bul...@gmail.com>> wrote:

    shuffled() should be in the random module, of course. I dont
    suggest a builtin. Although now that you mentioned it, I could go
    for that too.

    There are usage cases where its heavily used, in randomized
    testing for example. I am sure that there are also other domains
    where randomization of lists is used.

    Another reason to put it there is that using shuffle is
    inconvenient. The fact that I CAN write it myself doesnt mean that
    it doesnt belong in the standard library.

    Implementing this in pure python wont take a lot of work.

    pozdrawiam,
    Arkadiusz Bulski


    _______________________________________________
    Python-ideas mailing list
    Python-ideas@python.org <mailto:Python-ideas@python.org>
    https://mail.python.org/mailman/listinfo/python-ideas
    <https://mail.python.org/mailman/listinfo/python-ideas>
    Code of Conduct: http://python.org/psf/codeofconduct/
    <http://python.org/psf/codeofconduct/>




_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to