[issue9915] speeding up sorting with a key

Terry J. Reedy report at bugs.python.org
Fri Sep 24 23:49:51 CEST 2010


Terry J. Reedy <tjreedy at udel.edu> added the comment:

Does this help any?
>>> import random
>>> from timeit import timeit
>>> testlist = list(range(100000))
>>> random.shuffle(testlist)
>>> timeit('t=list(testlist); t.sort()',
    'from __main__ import testlist', number=1)
0.1467957519740679

I just learned the import trick from the tracker issue suggesting that it be made more prominent.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9915>
_______________________________________


More information about the Python-bugs-list mailing list