Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove "(" ")" when tuple used in return or in LHS of assignment? #20

Open
rocky opened this issue Jul 1, 2019 · 2 comments
Open

remove "(" ")" when tuple used in return or in LHS of assignment? #20

rocky opened this issue Jul 1, 2019 · 2 comments

Comments

@rocky
Copy link
Owner

rocky commented Jul 1, 2019

No description provided.

@msm-code
Copy link
Contributor

Is this still wanted? Happy to work on that @rocky.

(I agree that

a, b = foo()

looks cleanear and more pythonic than

(a, b) = foo()

so this looks like a good change. I've also reproduced this issue with the current master. The only thing I worry about is that this may require significant grammar changes (to detect this specific example of (tuple) = somethint), but I'll try.

@rocky
Copy link
Owner Author

rocky commented Feb 18, 2023

@msm-code actually, I believe this is just a matter of going over operator precedences and possibly the semantic rules that mention these so that LHS doesn't need a parenthesis around it in the context of an assignment statement. And if a rule is explicitly adding "(" .. ")" in a rule or action, then remove that and allow precedence to do its thing instead.

I have seem something like this come up in the latest not-public version where I have been revising things more from the ground up.

So if you get started there, I can try to fold in precedence changes from this version, and I think there were some code changes or grammar changes to ensure that "expr" gets used.

"expr" is the single location where precedence is used to add optional parenthesis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants