-
Notifications
You must be signed in to change notification settings - Fork 222
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomersparsingConverting source code into CST nodesConverting source code into CST nodes
Description
The fine docs say that elt in the various comprehension nodes are of type BaseAssignTargetExpression. This is a lie. Observe: in the syntactically correct and semantically plausible expression (i ** 2 for i in _), the elt is constructed from i**2 which is a BinaryOperation:
> echo "(i**2 for _ in _)" | python -m libcst.tool print -
Module(
body=[
SimpleStatementLine(
body=[
Expr(
value=GeneratorExp(
elt=BinaryOperation(
left=Name(
value='i',
),
operator=Power(),
right=Integer(
value='2',
),
),
for_in=CompFor(
target=Name(
value='i',
),
iter=Name(
value='_',
),
),
),
),
],
),
],
)
But alas, BinaryOperation is not a BaseAssignTargetExpression.
>>> issubclass(cst.BinaryOperation, cst.BaseAssignTargetExpression)
False
What is the correct type for elt here? BaseExpression?
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomersparsingConverting source code into CST nodesConverting source code into CST nodes