PEP 622: Update Appendix A Grammar#1466
Conversation
|
Hm, on second thought, I think it should be |
|
Hm, that will be tricky. I'm playing with the implementation, and it looks like |
|
I don't think we currently have a rule for "named expression or unparenthesized tuple", so I'll probably have to make one. |
|
How's this? Seems to work: |
|
Let @lysnikolaou review this. |
|
I'm currently offline. I'll review a bit later tonight. (I'll probably be back in about 3-4 hours) |
|
I'm not sure what exact syntax you want to allow but this would allow things like |
|
Yeah, that's my intent with it. It comes from two motivations:
|
|
I agree that |
I feel that I'd need to google this every time to find out if it means |
|
And if I were to guess, I'd probably guess the opposite of what it is, if I knew nothing about the grammar. |
|
I'll defer to @gvanrossum's judgement here, but I'm fine with it. I think he's out for a few days, so this can just be tabled until then. While I have you here: the new grammar gives a sort of odd error message for the string >>> match *x,:
...
File "<stdin>", line 1
^
SyntaxError: only single target (not tuple) can be annotatedI'm guessing that I need to look ahead somewhere to avoid this and get a normal "invalid syntax" message, but I haven't been able to figure it out. The grammar is here. |
|
By the way, I love your syntax highlighting VSCode extension. |
This is odd indeed. I'd have to take a closer look at this to find out what's going on. I'll make up some time tomorrow.
Thanks thanks! Glad you like it! |
|
Had some time to spare, so I looked a bit into this. It seems to be a bug in This meanns that, even without an expression after the colon, something could be considered an invalid annotation. This is what happens here, because Opened bpo-41119 and python/cpython#21160. |
|
Thanks for the quick fix! |
Deliberately omitting the mini-grammar on 139.