Skip to content

Commit 2765546

Browse files
committed
PEP 798: Add SC acceptance requirement
1 parent 1a1aff8 commit 2765546

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

peps/pep-0798.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ Post-History:
1313
`19-Jul-2025 <https://discuss.python.org/t/pep-798-unpacking-in-comprehensions/99435>`__,
1414
Resolution: `03-Nov-2025 <https://discuss.python.org/t/pep-798-unpacking-in-comprehensions/99435/60>`__
1515

16+
.. note::
17+
The Steering Council accepts this PEP with one modification: we require that
18+
both synchronous and asynchronous generator expressions use explicit loops
19+
rather than yield from for unpacking operations.
20+
21+
The Steering Council believes that simplicity and consistency are paramount
22+
here. The delegation behaviour provided by ``yield from`` adds semantic
23+
complexity for advanced use cases involving ``.send(),`` ``.throw()``, and
24+
``.close()`` that are rarely relevant when writing comprehensions. We don’t
25+
believe that developers writing comprehensions should have to think about
26+
the differences between sync and async generator semantics or about generator
27+
delegation protocols. We firmly believe that the mental model should be as
28+
simple as possible and as symmetric as possible between all kinds of
29+
comprehensions. The straightforward semantics of explicit loops provide a
30+
uniform mental model that works the same way regardless of context, and also
31+
provides better parity with the function-like versions, such as
32+
``itertools.chain.from_iterable``. For the rare cases where someone actually
33+
needs delegation behaviour, the Steering Council believes they should use an
34+
explicit generator function with ``yield from`` rather than a comprehension.
35+
1636

1737
Abstract
1838
========

0 commit comments

Comments
 (0)