]> granicus.if.org Git - python/commitdiff
Simplify demo code.
authorRaymond Hettinger <python@rcn.com>
Sun, 23 Mar 2008 00:55:46 +0000 (00:55 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 23 Mar 2008 00:55:46 +0000 (00:55 +0000)
Doc/library/itertools.rst
Lib/test/test_itertools.py

index 42f648ab045ed08644d6f30f1a3f04c5aac90f48..4a4db2927c664c432618d72259799eaff5c55eb2 100644 (file)
@@ -409,7 +409,7 @@ loops that truncate the stream.
             n = len(pool)
             r = n if r is None else r
             indices = range(n)
-            cycles = range(n-r+1, n+1)[::-1]
+            cycles = range(n, n-r, -1)
             yield tuple(pool[i] for i in indices[:r])
             while n:
                 for i in reversed(range(r)):
index 3b5cc23909321a16883b44c5ee09b57fb82b20c7..98cceb7f09eda0f1cad19a4cec7cf672c73d528b 100644 (file)
@@ -141,7 +141,7 @@ class TestBasicOps(unittest.TestCase):
             n = len(pool)
             r = n if r is None else r
             indices = range(n)
-            cycles = range(n-r+1, n+1)[::-1]
+            cycles = range(n, n-r, -1)
             yield tuple(pool[i] for i in indices[:r])
             while n:
                 for i in reversed(range(r)):