8000 [3.12] Itertools docs: fix parameter names and indentation in Python … · python/cpython@71ec353 · GitHub
[go: up one dir, main page]

Skip to content

Commit 71ec353

Browse files
[3.12] Itertools docs: fix parameter names and indentation in Python equivalents (gh-118977) (#119042)
1 parent 4695f1a commit 71ec353

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Doc/library/itertools.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ loops that truncate the stream.
372372
saved.append(element)
373373
while saved:
374374
for element in saved:
375-
yield element
375+
yield element
376376

377377
Note, this member of the toolkit may require significant auxiliary storage
378378
(depending on the length of the iterable).
@@ -607,10 +607,10 @@ loops that truncate the stream.
607607
This function is roughly equivalent to the following code, except that the
608608
actual implementation does not build up intermediate results in memory::
609609

610-
def product(*args, repeat=1):
610+
def product(*iterables, repeat=1):
611611
# product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy
612612
# product(range(2), repeat=3) → 000 001 010 011 100 101 110 111
613-
pools = [tuple(pool) for pool in args] * repeat
613+
pools = [tuple(pool) for pool in iterables] * repeat
614614
result = [[]]
615615
for pool in pools:
616616
result = [x+[y] for x in result for y in pool]
@@ -727,9 +727,9 @@ loops that truncate the stream.
727727
iterables are of uneven length, missing values are filled-in with *fillvalue*.
728728
Iteration continues until the longest iterable is exhausted. Roughly equivalent to::
729729

730-
def zip_longest(*args, fillvalue=None):
730+
def zip_longest(*iterables, fillvalue=None):
731731
# zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-
732-
iterators = [iter(it) for it in args]
732+
iterators = [iter(it) for it in iterables]
733733
num_active = len(iterators)
734734
if not num_active:
735735
return

0 commit comments

Comments
 (0)
0