GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Specialize syntax error for trailing comma of last item in `with` · Issue #145241 · python/cpython Closed Labels interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-parsertype-featureA feature request or enhancementA feature request or enhancement DescriptionFeature or enhancementProposal:Consider a specialized syntax error for these cases: with item,: pass with item as x,: pass whereas this would be correct syntax: with (item,): pass with (item as x,): pass This was taken from https://github.com/astral-sh/ruff/blob/6ff4da454c448f01eb0b71728f3941870c811bfc/crates/ruff_python_parser/resources/invalid/statements/with/unparenthesized_with_items.py. 2+ years in Ruff's parser. I'm not sure what the better message could be. Maybe one of these: Only this specific case seems to require parentheses to pass. with a, b: pass Or maybe we could allow no parentheses at all? But that's probably much more work for an edge case, would it be worth it? 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 PRsActivity
MetadataMetadataAssigneesLabelsinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-parsertype-featureA feature request or enhancementA feature request or enhancement ProjectsMilestoneRelationshipsDevelopmentIssue 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. |