This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients BTaskaya, benjamin.peterson, brett.cannon, gvanrossum, nascheme, ncoghlan, pablogsal, serhiy.storchaka, thautwarm, veky
Date 2020-03-07.13:35:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583588100.07.0.21873298237.issue34822@roundup.psfhosted.org>
In-reply-to
Content
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]
History
Date User Action Args
2020-03-07 13:35:00serhiy.storchakasetrecipients: + serhiy.storchaka, gvanrossum, brett.cannon, nascheme, ncoghlan, benjamin.peterson, veky, pablogsal, thautwarm, BTaskaya
2020-03-07 13:35:00serhiy.storchakasetmessageid: <1583588100.07.0.21873298237.issue34822@roundup.psfhosted.org>
2020-03-07 13:35:00serhiy.storchakalinkissue34822 messages
2020-03-07 13:35:00serhiy.storchakacreate