[issue34822] Simplify AST for slices

2020-03-10 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue34822] Simplify AST for slices

2020-03-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 13d52c268699f199a8e917a0f1dc4c51e5346c42 by Serhiy Storchaka in branch 'master': bpo-34822: Simplify AST for subscription. (GH-9605) https://github.com/python/cpython/commit/13d52c268699f199a8e917a0f1dc4c51e5346c42 --

[issue34822] Simplify AST for slices

2020-03-09 Thread Guido van Rossum
Guido van Rossum added the comment: I'm going to review the actual code next. Regarding the omission of parentheses in various contexts, I am all for that, but I consider it a separate issue (as it only pertains to ast.unparse()). The fix in https://github.com/python/cpython/pull/17892

[issue34822] Simplify AST for slices

2020-03-08 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: > Sorry, I did not know about your PR Batuhan and fixed this bug in issue39889. No problem. -- ___ Python tracker ___

[issue34822] Simplify AST for slices

2020-03-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry, I did not know about your PR Batuhan and fixed this bug in issue39889. After fixing the bug in the current code PR 9605 only simplifies the code. So in this case the new code is not more complex than correctly written old code. --

[issue34822] Simplify AST for slices

2020-03-07 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: Yes, there is an already PR about that the bug. Related PR: https://github.com/python/cpython/pull/17892 -- ___ Python tracker ___

[issue34822] Simplify AST for slices

2020-03-07 Thread Vedran Čačić
Vedran Čačić added the comment: Agree with the idea, but think the name is too narrow. How about `parethesized`? There are many contexts where parentheses look weird and can be omitted (e.g. after return statement), although subscripts are currently the only place where they are an outright

[issue34822] Simplify AST for slices

2020-03-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It was added to produce nicer output. Currently: >>> print(ast.unparse(ast.parse('a[i, j]'))) a[(i, j)] With PR 9605: >>> print(ast.unparse(ast.parse('a[i, j]'))) a[i, j] The current code is not consistent with outputting parenthesis: >>>

[issue34822] Simplify AST for slices

2020-03-07 Thread Nick Coghlan
Nick Coghlan added the comment: The one thing in the PR that makes me slightly wary is the point Vedran raised: in the old AST _Unparser code, the fact that index tuples containing slices should be printed without parentheses was encapsulated in the ExtSlice node type, but with Index and

[issue34822] Simplify AST for slices

2020-03-06 Thread Guido van Rossum
Guido van Rossum added the comment: Haven’t looked at the code but I welcome the simplification. -- nosy: +gvanrossum ___ Python tracker ___

[issue34822] Simplify AST for slices

2020-02-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: No, this PR does not change the Python syntax. It only changes the AST representation. -- ___ Python tracker ___

[issue34822] Simplify AST for slices

2020-02-18 Thread Vedran Čačić
Vedran Čačić added the comment: I wrote some AST analyzers, and this would have simplified my code. So I welcome it. :-) However, it means people might be tempted to write a[b:c, d]asa[(b:c, d)] (or at least expect it to work -- same as `a[b, c]` can now be written as `a[(b,

[issue34822] Simplify AST for slices

2020-02-17 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34822] Simplify AST for slices

2020-02-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Updated the PR. I can obviously be biased about my changes, so I need an approval of other core developer to merge them. I created several PRs to popular third-party projects which work with AST to support both old and new AST schemes. --

[issue34822] Simplify AST for slices

2020-02-14 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: Serhiy, any plans to bump this patch to 3.9 and continue / merge? In general the benefits looks great, but on the other hand this might cause some breakage which I guess as @nascheme is OK in AST. -- nosy: +BTaskaya, pablogsal

[issue34822] Simplify AST for slices

2018-10-03 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34822] Simplify AST for slices

2018-10-03 Thread Yury Selivanov
Change by Yury Selivanov : -- nosy: -yselivanov ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34822] Simplify AST for slices

2018-10-03 Thread Neil Schemenauer
Neil Schemenauer added the comment: Hello Serhiy, I've not reviewed the patch but I trust that if you say it simplifies things, that's so. Perhaps the important question is if it is okay to change the AST in backwards incompatible ways within 3.x releases. As a library author who could

[issue34822] Simplify AST for slices

2018-09-27 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +9002 stage: -> patch review ___ Python tracker ___ ___

[issue34822] Simplify AST for slices

2018-09-27 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Currently an AST for expressions can have non-terminal nodes of two types: expr and slice. Every of them can be a one of several kinds. A slice can be of kind Index (just an expression), Slice (optional expressions separated by ":") or ExtSlice (slices