From 37ea7b3cd4093b6238f3d6f86ca045ef8e87a8f6 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sat, 27 Jun 2026 16:17:41 -0500 Subject: [PATCH] Provide a cross-reference to PEP 798 unpacking syntax (GH-152454) (cherry picked from commit 8107c53f0f9f54e71dbdc4fde8f6cda5b3ef800c) Co-authored-by: Raymond Hettinger Co-authored-by: Rishit Agnihotri --- Doc/library/itertools.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 47c5326d137c50..79690208b70312 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -208,6 +208,10 @@ loops that truncate the stream. for iterable in iterables: yield from iterable + Note that :pep:`798` unpacking syntax provides similar functionality + so that ``list(chain(p, q))`` could be written as + ``[*s for s in (p, q)]``. + .. classmethod:: chain.from_iterable(iterable) @@ -219,6 +223,10 @@ loops that truncate the stream. for iterable in iterables: yield from iterable + Note that :pep:`798` unpacking syntax provides similar functionality + so that ``list(chain.from_iterable(iterables))`` could be written as + ``[*s for s in iterables]``. + .. function:: combinations(iterable, r)