Isaiah Peng <issa...@gmail.com> added the comment:

Thanks for the reply, that's quite reasonable, especially take the generator 
expression case into consideration. However I found this is not consistent with 
empty tuple:

>>> a = "()"                                                                    
>>>                                                                             
>>>                                   
>>> ast.parse(a).body[0].value.col_offset                                       
>>>                                                                             
>>>                                   
0

It's true that the parenthesis is required to construct a tuple, but if the 
parenthesis is served as the starting point of the tuple, then the col_offset 
should be the opening parenthesis. i.e. in the following example, both should 
start from col 2:

  >>> 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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33520>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to