On Fri, Sep 9, 2016 at 9:36 AM, Xavier Combelle <xavier.combe...@gmail.com> wrote: > and eventually this one work in all case of iterable > > def shuffled3(iterable): > result = list(iterable) > random.shuffle(result) > return result >
This is the one obvious way to do this. Not all iterables can logically be shuffled, so the most normal approach would be to turn it into a list, then shuffle. Which is exactly what this does. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/