New submission from Eugene Yunak: random.shuffle operates on a list, and changes it in place. I think returning a reference to this list, the same one we got in as the argument, is quite useful and makes it possible to use random.shuffle in chained function calls, e.g.:
somelist.append(''.join(shuffle(list('hello')))) [i for i in shuffle(list(range(10))) if i%2] I don't see any good arguments against this, and I couldn't think of a reasonable test for this — is it necessary to test whether the returned reference is the same as the one passed in? I'm open to any discussion or suggestions you might have. ---------- components: Library (Lib) files: shuffle_return.patch keywords: patch messages: 255971 nosy: Eugene Yunak priority: normal severity: normal status: open title: return from random.shuffle type: enhancement Added file: http://bugs.python.org/file41251/shuffle_return.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25811> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com