summaryrefslogtreecommitdiffstats
path: root/Modules/itertoolsmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-06-10 21:07:47 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-06-10 21:07:47 (GMT)
commit553e156921909c22fbc6d3c244d45606a746fa80 (patch)
tree82191d25cda6664a4904073064f44cd80b5d4b37 /Modules/itertoolsmodule.c
parent785273cd84a81a695a2707c0ef48df4f285f8699 (diff)
parentd741a880497b8458ef068c111caa64546166e3ff (diff)
downloadcpython-553e156921909c22fbc6d3c244d45606a746fa80.zip
cpython-553e156921909c22fbc6d3c244d45606a746fa80.tar.gz
cpython-553e156921909c22fbc6d3c244d45606a746fa80.tar.bz2
Fixed indentation of Python examples in C comments.
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r--Modules/itertoolsmodule.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index afff7e4..0291b24 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -2985,18 +2985,18 @@ def permutations(iterable, r=None):
cycles = range(n-r+1, n+1)[::-1]
yield tuple(pool[i] for i in indices[:r])
while n:
- for i in reversed(range(r)):
- cycles[i] -= 1
- if cycles[i] == 0:
- indices[i:] = indices[i+1:] + indices[i:i+1]
- cycles[i] = n - i
+ for i in reversed(range(r)):
+ cycles[i] -= 1
+ if cycles[i] == 0:
+ indices[i:] = indices[i+1:] + indices[i:i+1]
+ cycles[i] = n - i
+ else:
+ j = cycles[i]
+ indices[i], indices[-j] = indices[-j], indices[i]
+ yield tuple(pool[i] for i in indices[:r])
+ break
else:
- j = cycles[i]
- indices[i], indices[-j] = indices[-j], indices[i]
- yield tuple(pool[i] for i in indices[:r])
- break
- else:
- return
+ return
*/
typedef struct {