[Python-checkins] r65205 - python/trunk/Doc/library/itertools.rst
georg.brandl
python-checkins at python.org
Wed Jul 23 18:00:45 CEST 2008
Author: georg.brandl
Date: Wed Jul 23 18:00:44 2008
New Revision: 65205
Log:
Use correct indentation.
Modified:
python/trunk/Doc/library/itertools.rst
Modified: python/trunk/Doc/library/itertools.rst
==============================================================================
--- python/trunk/Doc/library/itertools.rst (original)
+++ python/trunk/Doc/library/itertools.rst Wed Jul 23 18:00:44 2008
@@ -675,17 +675,17 @@
filtered = ifilter(operator.itemgetter(1), decorated)
return imap(operator.itemgetter(0), filtered)
- def combinations_with_replacement(iterable, r):
- "combinations_with_replacement('ABC', 3) --> AA AB AC BB BC CC"
- pool = tuple(iterable)
- n = len(pool)
- indices = [0] * r
- yield tuple(pool[i] for i in indices)
- while 1:
- for i in reversed(range(r)):
- if indices[i] != n - 1:
- break
- else:
- return
- indices[i:] = [indices[i] + 1] * (r - i)
- yield tuple(pool[i] for i in indices)
+ def combinations_with_replacement(iterable, r):
+ "combinations_with_replacement('ABC', 3) --> AA AB AC BB BC CC"
+ pool = tuple(iterable)
+ n = len(pool)
+ indices = [0] * r
+ yield tuple(pool[i] for i in indices)
+ while 1:
+ for i in reversed(range(r)):
+ if indices[i] != n - 1:
+ break
+ else:
+ return
+ indices[i:] = [indices[i] + 1] * (r - i)
+ yield tuple(pool[i] for i in indices)
More information about the Python-checkins
mailing list