generated from pyiron/pyiron_module_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
When we encounter a typical if-...-else statement, we find anast.If:
def simple_if_else(x, y):
if my_cond(x, y): # noqa: SIM108
z = my_add(x, y)
else:
z = my_mul(x, y)
return zIt would be nice to extend WorkflowParser.handle_assignment to also handle ast.IfExp so we can parse an else-node out of the equivalent python:
def simple_if_else(x, y):
z = my_add(x, y) if my_cond(x, y) else my_mul(x, y)
return zI think such an extension should be quite straightforward. My current understanding is that if we have an assignment available (z above) then it's always possible to reformulate the weaker ast.IfExp back into the more powerful ast.If.
I want to focus on getting the core functionality up for all the control flow parsers before adding sugar to a given flow, so this can wait.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request