From e70bb8d6f25b5e9aa0b3221943e302392023d164 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sun, 23 Mar 2008 00:55:46 +0000 Subject: [PATCH] Simplify demo code. --- Doc/library/itertools.rst | 2 +- Lib/test/test_itertools.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 42f648ab045..4a4db2927c6 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 3b5cc239093..98cceb7f09e 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)):