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
Make the example more self-explanatory
  • Loading branch information
rhettinger committed Oct 17, 2022
commit 41acb455fe8c8d20ab379079e0f9c1da8bb35557
3 changes: 2 additions & 1 deletion Doc/library/itertools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ loops that truncate the stream.
.. doctest::

>>> flattened_data = ['roses', 'red', 'violets', 'blue', 'sugar', 'sweet']
>>> list(batched(flattened_data, 2))
>>> unflattened = list(batched(flattened_data, 2))
>>> unflattened
[['roses', 'red'], ['violets', 'blue'], ['sugar', 'sweet']]

>>> for batch in batched('ABCDEFG', 3):
Expand Down