Simplify demo code.

This commit is contained in:
Raymond Hettinger 2008-03-23 00:55:46 +00:00
parent e8f1b00372
commit e70bb8d6f2
2 changed files with 2 additions and 2 deletions

View 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)):

View 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)):