Make "perhaps you missed a comma?" hint in syntax warnings less cryptic
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
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-140893
- gh-143278
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Esamina prima le PR collegata gh-140893 e gh-143278, quindi controlla il comportamento dell'avviso di sintassi per esempi come [][""], [](), e 1[2]. Il lavoro è completo quando l'indicazione dell'avviso spiega chiaramente che potrebbe mancare una virgola tra gli elementi della sequenza, mentre gli esempi di avviso pertinenti continuano a comportarsi come previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100