You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Document unpacking in generator expressions (PEP 798) #159061
The docs added in #143055 do not talk about unpacking in generator expressions.
I first noticed it when visiting PEP 798: the floating historical document notice links to docs for lists, sets and dictionaries but not to generators.
Thanks @rik! I agree that unpacking in generator expressions is not as well documented as the other pieces of PEP 798. There are a few places where we did change the docs to reference unpacking in generator expressions, though:
It looks like there was some reorganization of that page after the original PEP 798 PR was merged, in which a more-general "Added in 3.15" referring to the grammar change might have been lost.
The examples in section 9.10 of the tutorial make use of unpacking, though it's not called out explicitly like it is for the list/set/dict comprehensions, so maybe we could use an extra sentence or two that explicitly state that unpacking in be used in generator expressions just like in list/set comprehensions.
Will wait to see what others say, but I'd be happy to submit a quick PR if others agree that it's worth making some changes.
I opened #159268 to add a flattening example and a Python 3.15 version note to the Generator expressions section in the Language Reference. AI disclosure: the documentation change was prepared with OpenAI Codex. The documentation build was not run.
Activity
adqm commentedon Oct 9, 2026
Thanks @rik! I agree that unpacking in generator expressions is not as well documented as the other pieces of PEP 798. There are a few places where we did change the docs to reference unpacking in generator expressions, though:
Will wait to see what others say, but I'd be happy to submit a quick PR if others agree that it's worth making some changes.
Marwan-verse commentedon Oct 12, 2026
I opened #159268 to add a flattening example and a Python 3.15 version note to the Generator expressions section in the Language Reference. AI disclosure: the documentation change was prepared with OpenAI Codex. The documentation build was not run.