[issue39989] Output closing parenthesis in ast.dump() on separate line

2020-03-22 Thread Anthony Sottile
Anthony Sottile added the comment: fwiw, astpretty's output looks like the black output: https://github.com/asottile/astpretty >>> astpretty.pprint(ast.parse('if x == y: y += 4').body[0]) If( lineno=1, col_offset=0, test=Compare( lineno=1, col_offset=3, lef

[issue39989] Output closing parenthesis in ast.dump() on separate line

2020-03-17 Thread Terry J. Reedy
Terry J. Reedy added the comment: The current output looks like Python code. The proposed revision looks more like C, and I find the example above less readable with the prominence given to what is close to noise. The difference is part of the reason I left C for Python over 2 decades ago.

[issue39989] Output closing parenthesis in ast.dump() on separate line

2020-03-17 Thread Mark Dickinson
Mark Dickinson added the comment: Ah yes; looking at the `black` output, there's also an opportunity for an exciting discussion about trailing commas here :-) -- ___ Python tracker _

[issue39989] Output closing parenthesis in ast.dump() on separate line

2020-03-17 Thread Eric V. Smith
Eric V. Smith added the comment: For what it's worth (which might not be much), here is what black produces: Module( body=[ Expr( value=Call( func=Name(id="spam", ctx=Load()), args=[Name(id="eggs", ctx=Load()), Constant(value="and cheese

[issue39989] Output closing parenthesis in ast.dump() on separate line

2020-03-17 Thread Mark Dickinson
Mark Dickinson added the comment: This feels like something that's very much down to personal preference. I also prefer the closing "]" and ")" characters on their own lines, but I'd be happy with an argument to ast.dump giving me that option. -- nosy: +mark.dickinson _

[issue39989] Output closing parenthesis in ast.dump() on separate line

2020-03-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18390 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19039 ___ Python tracker ___

[issue39989] Output closing parenthesis in ast.dump() on separate line

2020-03-17 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Currently ast.dump() in multiline mode (see issue37995) appends closing parenthesis to the end of the line: >>> import ast >>> node = ast.parse('spam(eggs, "and cheese")') >>> print(ast.dump(node, indent=3)) Module( body=[ Expr( value=Ca