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 benjamin.peterson, brett.cannon, samuelcolvin, serhiy.storchaka, yselivanov
Date 2018-11-21.12:20:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542802829.88.0.788709270274.issue31241@psf.upfronthosting.co.za>
In-reply-to
Content
For list comprehensions and generator expressions this is definitely a bug. But tuples syntax technically does not include surrounded parentheses.

There is also a problem with generator expression passes as a single argument. Generator expression parentheses can be collapsed with function call parentheses: f(a for a in b).

PR 10633 makes the following changes:

* Fixes position for list comprehensions and generator expressions.

* If generator expression parentheses are be collapsed with function call parentheses, the position of the AST node for the generator expression points to the left parenthesis.

* For tuples surrounded with parentheses, the position of the AST node points to the left brace. For tuples without parentheses, it points to the position of the first tuple item.

I am not sure whether these changes should be backported to maintained versions.
History
Date User Action Args
2018-11-21 12:20:29serhiy.storchakasetrecipients: + serhiy.storchaka, brett.cannon, benjamin.peterson, yselivanov, samuelcolvin
2018-11-21 12:20:29serhiy.storchakasetmessageid: <1542802829.88.0.788709270274.issue31241@psf.upfronthosting.co.za>
2018-11-21 12:20:29serhiy.storchakalinkissue31241 messages
2018-11-21 12:20:29serhiy.storchakacreate