#8230: make Lib/test/sortperf.py run on Python 3.

This commit is contained in:
Georg Brandl 2010-08-01 08:07:49 +00:00
parent f02e7367eb
commit f325e03f48
2 changed files with 6 additions and 4 deletions

View File

@ -118,12 +118,12 @@ def tabulate(r):
L = L * (n // 4) L = L * (n // 4)
# Force the elements to be distinct objects, else timings can be # Force the elements to be distinct objects, else timings can be
# artificially low. # artificially low.
L = map(lambda x: --x, L) L = list(map(lambda x: --x, L))
doit(L) # ~sort doit(L) # ~sort
del L del L
# All equal. Again, force the elements to be distinct objects. # All equal. Again, force the elements to be distinct objects.
L = map(abs, [-0.5] * n) L = list(map(abs, [-0.5] * n))
doit(L) # =sort doit(L) # =sort
del L del L
@ -131,11 +131,11 @@ def tabulate(r):
# for an older implementation of quicksort, which used the median # for an older implementation of quicksort, which used the median
# of the first, last and middle elements as the pivot. # of the first, last and middle elements as the pivot.
half = n // 2 half = n // 2
L = range(half - 1, -1, -1) L = list(range(half - 1, -1, -1))
L.extend(range(half)) L.extend(range(half))
# Force to float, so that the timings are comparable. This is # Force to float, so that the timings are comparable. This is
# significantly faster if we leave tham as ints. # significantly faster if we leave tham as ints.
L = map(float, L) L = list(map(float, L))
doit(L) # !sort doit(L) # !sort
print() print()

View File

@ -15,6 +15,8 @@ Core and Builtins
Library Library
------- -------
- Issue #8230: Fix Lib/test/sortperf.py.
- Issue #8620: when a Cmd is fed input that reaches EOF without a final - Issue #8620: when a Cmd is fed input that reaches EOF without a final
newline, it no longer truncates the last character of the last command line. newline, it no longer truncates the last character of the last command line.