You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is for tracking possible places where we could generate better code on ast.unparse (better as in more closely to what people are actually writing than our naive implementation).
Examples;
>>> import ast
>>> ast.unparse(ast.parse('a, b, c = [1,2,3]'))
'(a, b, c) = [1, 2, 3]'
could be
>>> ast.unparse(ast.parse('a, b, c = [1,2,3]'))
'a, b, c = [1, 2, 3]'
OR
>>> print(ast.unparse(ast.parse('if value := d.get("something"): print(value)')))
if (value := d.get('something')):
print(value)
could be
>>> print(ast.unparse(ast.parse('if value := d.get("something"): print(value)')))
if value := d.get('something'):
print(value)
We could even go further with the long line unpacking (which would definitely require some sort of clever algorithm for nested structures).
Activity
isidentical commentedon May 15, 2021
This issue is for tracking possible places where we could generate better code on ast.unparse (better as in more closely to what people are actually writing than our naive implementation).
We could even go further with the long line unpacking (which would definitely require some sort of clever algorithm for nested structures).
furkanonder commentedon May 9, 2023
@isidentical The issue seems to be solved. We can close the issue.