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 BTaskaya
Recipients BTaskaya
Date 2020-02-01.21:10:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580591407.68.0.673076668701.issue39520@roundup.psfhosted.org>
In-reply-to
Content
(this issue has already a PR for ast.unparse)

>>> from __future__ import annotations
>>> import ast
>>> x: Tuple[1:2,] = 3
>>> __annotations__["x"]
'Tuple[1:2]'
>>> ast.dump(ast.parse("Tuple[1:2,]"))
"Module(body=[Expr(value=Subscript(value=Name(id='Tuple', ctx=Load()), slice=ExtSlice(dims=[Slice(lower=Constant(value=1, kind=None), upper=Constant(value=2, kind=None), step=None)]), ctx=Load()))], type_ignores=[])"

>>> ast.dump(ast.parse("Tuple[1:2]"))
"Module(body=[Expr(value=Subscript(value=Name(id='Tuple', ctx=Load()), slice=Slice(lower=Constant(value=1, kind=None), upper=Constant(value=2, kind=None), step=None), ctx=Load()))], type_ignores=[])"
History
Date User Action Args
2020-02-01 21:10:07BTaskayasetrecipients: + BTaskaya
2020-02-01 21:10:07BTaskayasetmessageid: <1580591407.68.0.673076668701.issue39520@roundup.psfhosted.org>
2020-02-01 21:10:07BTaskayalinkissue39520 messages
2020-02-01 21:10:07BTaskayacreate