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 — Make "perhaps you missed a comma?" hint in syntax warnings less cryptic · Issue #140764 · python/cpython

Make "perhaps you missed a comma?" hint in syntax warnings less cryptic #140764

New issue
Copy link
New issue
Copy link
Open
Open
Make "perhaps you missed a comma?" hint in syntax warnings less cryptic#140764
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-parsertriagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-featureA feature request or enhancementA feature request or enhancement

Description

@ncoghlan
ncoghlan
opened on Oct 29, 2025
Issue body actions

Feature or enhancement

Proposal:

Syntax warnings for code like [][""], [](), and 1[2] finish with the hint "perhaps you missed a comma?"

>>> lambda: 1[2]
<python-input-23>:1: SyntaxWarning: 'int' object is not subscriptable; perhaps you missed a comma?
<function <lambda> at 0x705dfb04b920>

When this came up in a review of currently emitted syntax warnings, it took me a moment to realise that it was suggesting the two subexpressions might have been supposed to be separate items in a sequence definition.

While I expect this would be clearer in the context of an actual warning, in isolation it felt very cryptic. Perhaps it would make sense to expand the hint to "did you miss a comma to separate sequence elements?"

Edit: Amended proposed text as @hugovk suggested

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

  • gh-140764: Make "missed comma" syntax warning less cryptic #140893
  • gh-140764: Improve syntax warning hint for missing commas #143278
Reacted by Sohang Chopra

Activity

  1. ncoghlan
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Oct 29, 2025
  2. StanFromIreland
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Oct 29, 2025
  3. hugovk commented on Oct 29, 2025

    @hugovk
    hugovk
    on Oct 29, 2025
    Member
    More actions

    We can also be more direct and concise:

    "Did you miss..."

    Rather than:

    "Perhaps you missed..."

    Reacted by Alyssa Coghlan, Stan Ulbrych, ryan-duve, Bartosz Sławecki and Sohang Chopra
  4. StanFromIreland
    added
    easy
    on Oct 29, 2025
  5. StanFromIreland commented on Oct 29, 2025

    @StanFromIreland
    StanFromIreland
    on Oct 29, 2025
    Member
    More actions

    Marking this as easy, contributors beware this is easy C, not easy Python.

    Reacted by Dmitriy Vashurin, Abduaziz and Sohang Chopra
  6. ncoghlan
    added
    triagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.
    on Oct 29, 2025
  7. 7576457 commented on Oct 29, 2025

    @7576457
    7576457
    on Oct 29, 2025
    More actions

    I’d like to work on this

  8. StanFromIreland commented on Oct 29, 2025

    @StanFromIreland
    StanFromIreland
    on Oct 29, 2025
    Member
    More actions

    Go ahead!

  9. adqm commented on Oct 31, 2025

    @adqm
    adqm
    on Oct 31, 2025
    Contributor
    More actions

    "miss" is also an interesting choice of verb there because it has multiple meanings. Maybe "forget" or "omit" or something might be more apt?

    Also, even though it might require a more-substantial rearrangement of the code than just changing the message, maybe it would be good only to emit this warning in contexts where commas make sense (list/set/dict displays, argument lists, etc)?

  10. serhiy-storchaka commented on Oct 31, 2025

    @serhiy-storchaka
    serhiy-storchaka
    on Oct 31, 2025
    Member
    More actions

    The original message was written taking existing syntax warning "assertion is always true, perhaps remove parentheses?" and syntax error "expression cannot contain assignment, perhaps you meant "=="?" as examples. @gvanrossum then corrected it.

  11. tadejmagajna commented on Dec 6, 2025

    @tadejmagajna
    tadejmagajna
    on Dec 6, 2025
    Contributor
    More actions

    Glad to see the community addressing this long-standing source of confusion!

    Noticed PR #140893 from @alonme is blocked by a missing NEWS entry. Assuming consensus on the wording, are you still planning to complete it?
    If not, I can help with a follow-up PR including co-author info.

    If merged, as part of a separate activity, should we also ensure consistency across the other two perhaps you missed a comma cases (object is not callable and indices must be integers or slices)? Happy to help if needed.

  12. alonme commented on Dec 6, 2025

    @alonme
    alonme
    on Dec 6, 2025
    Contributor
    More actions

    @tadejmagajna I am not sure if its stuck because of the news entry - i am waiting for a review.

  13. hugovk commented on Dec 7, 2025

    @hugovk
    hugovk
    on Dec 7, 2025
    Member
    More actions

    @alonme It needs a news entry, please add one.

  14. alonme commented on Dec 7, 2025

    @alonme
    alonme
    on Dec 7, 2025
    Contributor
    More actions

    Thanks, added

    Reacted by Hugo van Kemenade
  15. ayushm98
    added a commit that references this issue on Dec 29, 2025

    Improve syntax warning hint for missing commas

    This issue will close once commit 4f4e72f is merged into the 'main' branch.
    4f4e72f
  16. picnixz
    removed
    easy
    on Dec 30, 2025
  17. picnixz commented on Dec 30, 2025

    @picnixz
    picnixz
    on Dec 30, 2025
    Member
    More actions

    Removing the easy label as we already have an open PR.

  18. serhiy-storchaka
    added
    topic-parser
    on Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-parsertriagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — 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.