Łukasz Langa <[email protected]> added the comment:
This is because technically parentheses aren't part of the tuple. They are
just organizational and unnecessary for the tuple to be recognized by the
parser.
Those two are equivalent:
>>> ast.parse("(1,2,3)").body[0].value.col_offset
1
>>> ast.parse("(1)").body[0].value.col_offset
1
You can see similar behavior within generator expressions in contexts where the
parentheses are not semantically required:
>>> ast.parse("c(i for i in range(10))").body[0].value.args[0].col_offset
2
>>> ast.parse("c((i for i in range(10)))").body[0].value.args[0].col_offset
3
----------
nosy: +lukasz.langa
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33520>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com