bpo-41979: Accept star-unpacking on with-item targets#22611
Conversation
|
FWIW there are some differences here in the |
What syntax error are you referring to? |
I'm not saying we should change something here. I'm just mentioning the differences, so that we know about them. Thoughts? |
Oh, thanks for the example! I think the second one may be a bit confusing to users (you can use star expressions there but as the first error mentions, must be in a list or a tuple). I will try to create a PR today for this, but I think we can treat it separately from this one, what do you think? |
|
FWIW, this behavior is the exact same thing with other assignments; |
Yeah, that's why I proposed to treat this independently of this PR. I will create a patch for this syntax error today if I find the time |
Agreed. What bugs me most is that in the |
But that only makes sense in the REPL no? We can look together later how to make this fail before if you wish. Likely is a matter of restricting some of that rule or checking the order. But I would be cautious of this as it probably will raise the complexity of the grammar a bit. |
|
Thanks @isidentical for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
|
Sorry, @isidentical and @pablogsal, I could not cleanly backport this to |
|
@isidentical Can you do the backport, please? |
|
Agreed, let's merge this and come back to it later. |
|
GH-22612 is a backport of this pull request to the 3.9 branch. |
GH-22612) Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com> Automerge-Triggered-By: @pablogsal
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
https://bugs.python.org/issue41979