Skip to content

Commit a705c1e

Browse files
authored
Itertools docs: fix parameter names and indentation in Python equivalents (gh-118977)
1 parent ec1398e commit a705c1e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Doc/library/itertools.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ loops that truncate the stream.
380380
saved.append(element)
381381
while saved:
382382
for element in saved:
383-
yield element
383+
yield element
384384

385385
Note, this member of the toolkit may require significant auxiliary storage
386386
(depending on the length of the iterable).
@@ -615,10 +615,10 @@ loops that truncate the stream.
615615
This function is roughly equivalent to the following code, except that the
616616
actual implementation does not build up intermediate results in memory::
617617

618-
def product(*args, repeat=1):
618+
def product(*iterables, repeat=1):
619619
# product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy
620620
# product(range(2), repeat=3) → 000 001 010 011 100 101 110 111
621-
pools = [tuple(pool) for pool in args] * repeat
621+
pools = [tuple(pool) for pool in iterables] * repeat
622622
result = [[]]
623623
for pool in pools:
624624
result = [x+[y] for x in result for y in pool]
@@ -735,9 +735,9 @@ loops that truncate the stream.
735735
iterables are of uneven length, missing values are filled-in with *fillvalue*.
736736
Iteration continues until the longest iterable is exhausted. Roughly equivalent to::
737737

738-
def zip_longest(*args, fillvalue=None):
738+
def zip_longest(*iterables, fillvalue=None):
739739
# zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-
740-
iterators = [iter(it) for it in args]
740+
iterators = [iter(it) for it in iterables]
741741
num_active = len(iterators)
742742
if not num_active:
743743
return

0 commit comments

Comments
 (0)