Skip to content

Commit 37ea7b3

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 65d110d commit 37ea7b3

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
@@ -208,6 +208,10 @@ loops that truncate the stream.
208208
for iterable in iterables:
209209
yield from iterable
210210

211+
Note that :pep:`798` unpacking syntax provides similar functionality
212+
so that ``list(chain(p, q))`` could be written as
213+
``[*s for s in (p, q)]``.
214+
211215

212216
.. classmethod:: chain.from_iterable(iterable)
213217

@@ -219,6 +223,10 @@ loops that truncate the stream.
219223
for iterable in iterables:
220224
yield from iterable
221225

226+
Note that :pep:`798` unpacking syntax provides similar functionality
227+
so that ``list(chain.from_iterable(iterables))`` could be written as
228+
``[*s for s in iterables]``.
229+
222230

223231
.. function:: combinations(iterable, r)
224232

0 commit comments

Comments
 (0)