From 4bdfb5a925741019be86f81edb64014801f5c9cf Mon Sep 17 00:00:00 2001 From: Twix1288 Date: Sat, 27 Jun 2026 13:34:59 -0700 Subject: [PATCH] gh-152397: Add note to itertools.chain.from_iterable docs re PEP 798 --- Doc/library/itertools.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 06f8bf2a8b6fa81..28b1d5f232c3f67 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -208,6 +208,17 @@ loops that truncate the stream. for iterable in iterables: yield from iterable + .. note:: + In Python 3.15+, the inline unpacking form ``(*it for it in iterables)`` + (added by :pep:`798`) provides a more readable alternative for simple + flattening:: + + # equivalent to chain.from_iterable(iterables) + (*it for it in iterables) + + ``chain.from_iterable`` remains useful as a first-class callable and + for compatibility with earlier Python versions. + .. function:: combinations(iterable, r)