GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Disallow lone starred expressions at the *grammar* level · Issue #156058 · python/cpython

Disallow lone starred expressions at the *grammar* level #156058

New issue
Copy link
New issue
Copy link
Open
Open
Disallow lone starred expressions at the *grammar* level#156058
Copy link
Assignees
encukou
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-parser

Description

@encukou
encukou
opened on Aug 19, 2026
Issue body actions

Statements like the following (where () can be any iterable -- or at the syntax level, any value):

  • *()
  • x = *()
  • yield *()
  • return *()
  • for _ in *(): ...

are not valid without a comma after the iterable.
These are allowed by python.gram and only rejected in the code generation step. This means that the documented Full Grammar specification is incomplete. We can do better.

Linked PRs

  • gh-156058: Disallow lone starred expressions at the grammar level #156059

Activity

  1. encukou
    self-assigned this
    on Aug 19, 2026
  2. encukou
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Aug 19, 2026
  3. encukou
    added a parent issue on Aug 19, 2026
    • Reword the Expressions chapter of the docs #141984
  4. encukou
    added this to docs issueson Aug 19, 2026
  5. encukou
    added
    topic-parser
    on Aug 19, 2026
  6. github-project-automation
    moved this to Todo in docs issueson Aug 19, 2026
  7. encukou
    removed a parent issue on Aug 19, 2026
    • Reword the Expressions chapter of the docs #141984
  8. encukou
    added a parent issue on Aug 19, 2026
    • Align the grammar documentation with Python's actual grammar #127833
  9. encukou commented on Aug 19, 2026

    @encukou
    encukou
    on Aug 19, 2026
    MemberAuthor
    More actions

    I'm sending a draft PR to show the change to make, as I open discussion on whether we want to make changes like this.

  10. sirosen commented on Aug 24, 2026

    @sirosen
    sirosen
    on Aug 24, 2026
    Contributor
    More actions

    It seems to work in the new comprehension syntax, unless I misunderstood the issue.

    x = [*range(5) for _ in range (3)]

    That said, no opinion from me on where or how invalid usages are caught.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @encukou
    encukou

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-parser

Projects

  • docs issues
    Status
    Todo
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.