Clarify error message when unpacking objects with `*` and `**`
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
When attempting to unpack a list (or any other non-mapping) as a mapping, one gets this error message:
builtins.TypeError: 'list' object is not a mapping
It's confusing, especially since sometimes the unpacking is done on a long multi-line statement, and it's not clear that the unpacking is the source of the error.
I suggest modifying to:
builtins.TypeError: Can't unpack 'list' object using ** because it's not a mapping
I'll be happy to submit a pull request if you agree with this change.
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
Non viene indicato alcun file o test. Cerca in CPython l’errore esistente "object is not a mapping" e segui il punto di ingresso del ** unpacking; poi aggiungi la copertura per l’unpacking di una lista con ** e verifica che il TypeError risultante identifichi l’operazione e il tipo di oggetto come richiesto.
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
- 45/100