Alessandro Moura added the comment: The int=int still makes no difference, but if the second argument is set to random.random, we get a big speedup, regardless of whether the third argument is there:
without int=int: amoura@amoura-laptop:~/cpython$ time ./python -c "import random; lst=list(range(1000000)); random.shuffle(lst,random.random); print (len(lst))" 1000000 real 0m7.082s user 0m6.952s sys 0m0.116s With int=int: amoura@amoura-laptop:~/cpython$ time ./python -c "import random; lst=list(range(1000000)); random.shuffle(lst,random.random); print (len(lst))" 1000000 real 0m7.281s user 0m7.156s sys 0m0.100s Without second argument: amoura@amoura-laptop:~/cpython$ time ./python -c "import random; lst=list(range(1000000)); random.shuffle(lst); print (len(lst))" 1000000 real 0m13.783s user 0m13.609s sys 0m0.108s This could be because of the many tests of whether the 2nd argument is None in the loop. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15837> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com