Skip to content

Commit 9f80ea2

Browse files
rhettingerTwix1288
authored andcommitted
Provide a cross-reference to PEP 798 unpacking syntax (GH-152454)
(cherry picked from commit 8107c53) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com> Co-authored-by: Rishit Agnihotri <Twix1288@users.noreply.github.com>
1 parent af3c912 commit 9f80ea2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Doc/library/itertools.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ loops that truncate the stream.
200200
for iterable in iterables:
201201
yield from iterable
202202

203+
Note that :pep:`798` unpacking syntax provides similar functionality
204+
so that ``list(chain(p, q))`` could be written as
205+
``[*s for s in (p, q)]``.
206+
203207

204208
.. classmethod:: chain.from_iterable(iterable)
205209

@@ -211,6 +215,10 @@ loops that truncate the stream.
211215
for iterable in iterables:
212216
yield from iterable
213217

218+
Note that :pep:`798` unpacking syntax provides similar functionality
219+
so that ``list(chain.from_iterable(iterables))`` could be written as
220+
``[*s for s in iterables]``.
221+
214222

215223
.. function:: combinations(iterable, r)
216224

0 commit comments

Comments
 (0)