From c9a5a0e1650b264bdf75e63ecdb577a46adbfd4c Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 1 Sep 2009 07:34:27 +0000 Subject: #6814: remove traces of xrange(). --- Doc/includes/mp_pool.py | 6 +++--- Doc/library/os.rst | 2 +- Objects/listsort.txt | 2 +- Objects/rangeobject.c | 2 +- Tools/pybench/README | 7 ++----- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Doc/includes/mp_pool.py b/Doc/includes/mp_pool.py index 46eac5a..e360703 100644 --- a/Doc/includes/mp_pool.py +++ b/Doc/includes/mp_pool.py @@ -98,17 +98,17 @@ def test(): t = time.time() A = list(map(pow3, range(N))) - print('\tmap(pow3, xrange(%d)):\n\t\t%s seconds' % \ + print('\tmap(pow3, range(%d)):\n\t\t%s seconds' % \ (N, time.time() - t)) t = time.time() B = pool.map(pow3, range(N)) - print('\tpool.map(pow3, xrange(%d)):\n\t\t%s seconds' % \ + print('\tpool.map(pow3, range(%d)):\n\t\t%s seconds' % \ (N, time.time() - t)) t = time.time() C = list(pool.imap(pow3, range(N), chunksize=N//8)) - print('\tlist(pool.imap(pow3, xrange(%d), chunksize=%d)):\n\t\t%s' \ + print('\tlist(pool.imap(pow3, range(%d), chunksize=%d)):\n\t\t%s' \ ' seconds' % (N, N//8, time.time() - t)) assert A == B == C, (len(A), len(B), len(C)) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 206a15c..2548b70 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -396,7 +396,7 @@ by file descriptors. Close all file descriptors from *fd_low* (inclusive) to *fd_high* (exclusive), ignoring errors. Availability: Unix, Windows. Equivalent to:: - for fd in xrange(fd_low, fd_high): + for fd in range(fd_low, fd_high): try: os.close(fd) except OSError: diff --git a/Objects/listsort.txt b/Objects/listsort.txt index 31a5445..47fec1d 100644 --- a/Objects/listsort.txt +++ b/Objects/listsort.txt @@ -606,7 +606,7 @@ from time import clock as now def fill(n): from random import random - return [random() for i in xrange(n)] + return [random() for i in range(n)] def mycmp(x, y): global ncmp diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 6d3e8b0..88ca698 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -431,7 +431,7 @@ PyTypeObject PyRangeIter_Type = { rangeiter_new, /* tp_new */ }; -/* Return number of items in range/xrange (lo, hi, step). step > 0 +/* Return number of items in range (lo, hi, step). step > 0 * required. Return a value < 0 if & only if the true value is too * large to fit in a signed long. */ diff --git a/Tools/pybench/README b/Tools/pybench/README index b015124..e33d064 100644 --- a/Tools/pybench/README +++ b/Tools/pybench/README @@ -260,10 +260,7 @@ class IntegerCounting(Test): # Run test rounds # - # NOTE: Use xrange() for all test loops unless you want to face - # a 20MB process ! - # - for i in xrange(self.rounds): + for i in range(self.rounds): # Repeat the operations per round to raise the run-time # per operation significantly above the noise level of the @@ -305,7 +302,7 @@ class IntegerCounting(Test): a = 1 # Run test rounds (without actually doing any operation) - for i in xrange(self.rounds): + for i in range(self.rounds): # Skip the actual execution of the operations, since we # only want to measure the test's administration overhead. -- cgit v0.12