Skip to content

Addition operand as a list of nodes#55

Merged
tbittar merged 11 commits intomainfrom
addition-operand-list
Sep 18, 2024
Merged

Addition operand as a list of nodes#55
tbittar merged 11 commits intomainfrom
addition-operand-list

Conversation

@sylvlecl
Copy link
Member

@sylvlecl sylvlecl commented Sep 10, 2024

Description

Replaces binary operators for additions and subtractions by a multi-operand
addition operator.
This simple change allows to solve most recursion depth issues while not
changing the current logic.

The only place ranges are allowed is now in time sum,
not any more in the too large time shift operator.
For now we remove the possibility to have multiple
explicit indices in a sum, it's not actually used.

Signed-off-by: Sylvain Leclerc <sylvain.leclerc@rte-france.com>
Only printing remains to update

Signed-off-by: Sylvain Leclerc <sylvain.leclerc@rte-france.com>
Signed-off-by: Sylvain Leclerc <sylvain.leclerc@rte-france.com>
Signed-off-by: Sylvain Leclerc <sylvain.leclerc@rte-france.com>
Signed-off-by: Sylvain Leclerc <sylvain.leclerc@rte-france.com>
Signed-off-by: Sylvain Leclerc <sylvain.leclerc@rte-france.com>
Signed-off-by: Sylvain Leclerc <sylvain.leclerc@rte-france.com>
Signed-off-by: Sylvain Leclerc <sylvain.leclerc@rte-france.com>
@sylvlecl sylvlecl force-pushed the addition-operand-list branch from 8b49dec to 8aa8a05 Compare September 10, 2024 15:00
@sylvlecl sylvlecl changed the base branch from support-parameters-in-sum to remove-instances September 10, 2024 15:01
Signed-off-by: Sylvain Leclerc <sylvain.leclerc@rte-france.com>
@sylvlecl sylvlecl marked this pull request as ready for review September 10, 2024 15:14
Signed-off-by: Sylvain Leclerc <sylvain.leclerc@rte-france.com>
right_value = visit(node.right, self)
return left_value - right_value
operands = [visit(o, self) for o in node.operands]
res = operands[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not directly res = sum([operand for operand in operands]) ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the builtin sum can only return ints. I could not make it work (indeed that was my first intent), maybe I missed something :/

Base automatically changed from remove-instances to main September 18, 2024 14:48
@tbittar tbittar merged commit a447724 into main Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants