]> granicus.if.org Git - python/commitdiff
#6814: remove traces of xrange().
authorGeorg Brandl <georg@python.org>
Tue, 1 Sep 2009 07:34:27 +0000 (07:34 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 1 Sep 2009 07:34:27 +0000 (07:34 +0000)
Doc/includes/mp_pool.py
Doc/library/os.rst
Objects/listsort.txt
Objects/rangeobject.c
Tools/pybench/README

index 46eac5a8a90cbad792f86b74132a4584d70984ef..e360703bd1e78178015d2d97bc350ac849277903 100644 (file)
@@ -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))
index 206a15ca341abca49c476c63238c52ad512f9466..2548b7096669040ae261b08e9098cb7e21ea28e4 100644 (file)
@@ -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:
index 31a5445c0e3d3b107890d7f12da8f913222962f7..47fec1d0a1cff689fa2044b87ac4edb8237e59ef 100644 (file)
@@ -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
index 6d3e8b0c930a217403980ea9021fc449527b4f1b..88ca69834857da77d3c22ddc7a4fcb9fd5b87f80 100644 (file)
@@ -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.
  */
index b015124719195e0f8e4a5fb49456fc0cfc65b46e..e33d0647006002b695cf05306d8528ae2b21a263 100644 (file)
@@ -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.