summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Doc/library/itertools.rst2
-rw-r--r--Lib/test/test_itertools.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 42f648ab04..4a4db2927c 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -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)):
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 3b5cc23909..98cceb7f09 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -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)):