Skip to content

Commit 9531611

Browse files
committed
switch back to simple loop example
1 parent 4c671ec commit 9531611

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: Doc/library/itertools.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,12 @@ loops that truncate the stream.
476476
Roughly equivalent to::
477477

478478
def ilen(iterable):
479-
return sum(1 for _ in iterable)
479+
# ilen([]) → 0
480+
# ilen('ABCDE') → 5
481+
length = 0
482+
for _ in iterable:
483+
length += 1
484+
return length
480485

481486
.. versionadded:: 3.14
482487

0 commit comments

Comments
 (0)