Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit877336b

Browse files
pochmann3miss-islington
authored andcommitted
Itertools docs: fix parameter names and indentation in Python equivalents (pythongh-118977)
(cherry picked from commita705c1e)Co-authored-by: pochmann3 <150468338+pochmann3@users.noreply.github.com>
1 parent041cc2a commit877336b

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
@@ -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 inargs] * repeat
621+
pools = [tuple(pool) for pool initerables] * 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 inargs]
740+
iterators = [iter(it) for it initerables]
741741
num_active = len(iterators)
742742
if not num_active:
743743
return

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp