Kaydet (Commit) 73866626 authored tarafından Sandro Tosi's avatar Sandro Tosi

use list() to wrap range() in itertools.permutations() example; thanks to Romain…

use list() to wrap range() in itertools.permutations() example; thanks to Romain MORLEVAT from docs@
üst 3e6c814b
...@@ -419,7 +419,7 @@ loops that truncate the stream. ...@@ -419,7 +419,7 @@ loops that truncate the stream.
if r > n: if r > n:
return return
indices = list(range(n)) indices = list(range(n))
cycles = range(n, n-r, -1) cycles = list(range(n, n-r, -1))
yield tuple(pool[i] for i in indices[:r]) yield tuple(pool[i] for i in indices[:r])
while n: while n:
for i in reversed(range(r)): for i in reversed(range(r)):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment