summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-06-10 21:06:39 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-06-10 21:06:39 (GMT)
commitd741a880497b8458ef068c111caa64546166e3ff (patch)
tree420566f184821407b3fe48e2c47fe3769657a8ff /Modules
parent6250df81bfbe567bb12c6dc29af149c62f35afa6 (diff)
downloadcpython-d741a880497b8458ef068c111caa64546166e3ff.zip
cpython-d741a880497b8458ef068c111caa64546166e3ff.tar.gz
cpython-d741a880497b8458ef068c111caa64546166e3ff.tar.bz2
Fixed indentation of Python examples in C comments.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/itertoolsmodule.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 1f42022..6634a17 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 {