Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tighter wording for cycle()
  • Loading branch information
rhettinger committed May 27, 2024
commit 61f629dd9d7f9caa9627e9412e273daadf38b866
10 changes: 5 additions & 5 deletions Doc/library/itertools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ loops that truncate the stream.

.. function:: cycle(iterable)

Make an iterator returning elements from the iterable and saving a copy of each.
When the iterable is exhausted, return elements from the saved copy. Repeats
indefinitely. Roughly equivalent to::
Make an iterator returning elements from the *iterable* and saving a
copy of each. When the iterable is exhausted, return elements from
the saved copy. Repeats indefinitely. Roughly equivalent to::

def cycle(iterable):
# cycle('ABCD') β†’ A B C D A B C D A B C D ...
Expand All @@ -361,8 +361,8 @@ loops that truncate the stream.
for element in saved:
yield element

Note, this member of the toolkit may require significant auxiliary storage
(depending on the length of the iterable).
This itertool may require significant auxiliary storage (depending on
the length of the iterable).


.. function:: dropwhile(predicate, iterable)
Expand Down