with statement star target
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
Documentation
https://docs.python.org/3/reference/simple_stmts.html#grammar-token-python-grammar-target
According to the docs, the grammar for the with statement allows:
with_stmt ::= "with" with_stmt_contents
with_stmt_contents ::= with_item
with_item ::= expression "as" target
target ::= identifier | "*" target
from my understanding that would allow a python syntax like this:
class Test:
def __enter__(self):
return (1, 2)
def __exit__(self, exc_type, exc_value, traceback):
pass
with Test() as *mambo:
print(mambo, type(mambo))
But for me with python version 3.12.8
I get a syntax error:
File "/home/gringo/accessia/main/controller_start/test.py", line 9
with Test() as *mambo:
^^^^^^
SyntaxError: starred assignment target must be in a list or tuple
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
Inizia con la sezione referenziata della Python language-reference sulla grammatica di with-statement e riproduci l'esempio con Python 3.12.8. Confronta la grammatica di destinazione documentata con il SyntaxError segnalato. Il lavoro è completato quando la documentazione e il comportamento osservato sono riconciliati e la formulazione o la grammatica pertinente è stata chiarita.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100