Serhiy Storchaka <[email protected]> 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:
>>> print(ast.unparse(ast.parse('a[i:j, k]')))
a[i:j, k]
It also produces the same output for a[i:j] and a[i:j,] which have different
AST and compiled to different bytecode (this is a bug).
>>> print(ast.unparse(ast.parse('a[i:j,]')))
a[i:j]
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34822>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com