Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9a5a0e

Browse files
committed
#6814: remove traces of xrange().
1 parent a4c05a2 commit c9a5a0e

5 files changed

Lines changed: 8 additions & 11 deletions

File tree

Doc/includes/mp_pool.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,17 @@ def test():
9898

9999
t = time.time()
100100
A = list(map(pow3, range(N)))
101-
print('\tmap(pow3, xrange(%d)):\n\t\t%s seconds' % \
101+
print('\tmap(pow3, range(%d)):\n\t\t%s seconds' % \
102102
(N, time.time() - t))
103103

104104
t = time.time()
105105
B = pool.map(pow3, range(N))
106-
print('\tpool.map(pow3, xrange(%d)):\n\t\t%s seconds' % \
106+
print('\tpool.map(pow3, range(%d)):\n\t\t%s seconds' % \
107107
(N, time.time() - t))
108108

109109
t = time.time()
110110
C = list(pool.imap(pow3, range(N), chunksize=N//8))
111-
print('\tlist(pool.imap(pow3, xrange(%d), chunksize=%d)):\n\t\t%s' \
111+
print('\tlist(pool.imap(pow3, range(%d), chunksize=%d)):\n\t\t%s' \
112112
' seconds' % (N, N//8, time.time() - t))
113113

114114
assert A == B == C, (len(A), len(B), len(C))

Doc/library/os.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ by file descriptors.
396396
Close all file descriptors from *fd_low* (inclusive) to *fd_high* (exclusive),
397397
ignoring errors. Availability: Unix, Windows. Equivalent to::
398398

399-
for fd in xrange(fd_low, fd_high):
399+
for fd in range(fd_low, fd_high):
400400
try:
401401
os.close(fd)
402402
except OSError:

Objects/listsort.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ from time import clock as now
606606

607607
def fill(n):
608608
from random import random
609-
return [random() for i in xrange(n)]
609+
return [random() for i in range(n)]
610610

611611
def mycmp(x, y):
612612
global ncmp

Objects/rangeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ PyTypeObject PyRangeIter_Type = {
431431
rangeiter_new, /* tp_new */
432432
};
433433

434-
/* Return number of items in range/xrange (lo, hi, step). step > 0
434+
/* Return number of items in range (lo, hi, step). step > 0
435435
* required. Return a value < 0 if & only if the true value is too
436436
* large to fit in a signed long.
437437
*/

Tools/pybench/README

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,7 @@ class IntegerCounting(Test):
260260

261261
# Run test rounds
262262
#
263-
# NOTE: Use xrange() for all test loops unless you want to face
264-
# a 20MB process !
265-
#
266-
for i in xrange(self.rounds):
263+
for i in range(self.rounds):
267264

268265
# Repeat the operations per round to raise the run-time
269266
# per operation significantly above the noise level of the
@@ -305,7 +302,7 @@ class IntegerCounting(Test):
305302
a = 1
306303

307304
# Run test rounds (without actually doing any operation)
308-
for i in xrange(self.rounds):
305+
for i in range(self.rounds):
309306

310307
# Skip the actual execution of the operations, since we
311308
# only want to measure the test's administration overhead.

0 commit comments

Comments
 (0)