Campbell Barton added the comment: @r.david.murray, yes, this avoids list creation, but is still quite slow.
To create 1mb of data, you can compare the following: python -m timeit -s 'from os import urandom' 'print(len(urandom(1000000)))' python -m timeit -s 'from random import randint' 'print(len(bytes(randint(0, 255) for i in range(1000000))))' On my system `os.urandom` is 0.04sec, using randint takes 2.24sec (approx 50x slower). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27096> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com