Closed joostvanzwieten closed 3 months ago
I created commit 8159737 as a suggestion for making comments inline, simply by making them an argument of
Assign
. It's crude but effective, and I personally find the resulting code easier to follow.
I've replaced _pyast.Comment
with _pyast.CommentBlock(comment, statements)
, which appends comment
to the next line if the statements
is a single line.
Previously
Evaluable
s were evaluated by looping over all dependencies and callingEvaluable.evalf
. For1 + 2 + 3
(not simplified) this boils down toThis PR replaces this mechanism by generating Python code via the new
evaluable.compile()
function, which produces:In addition, subtrees that are constant are cached for a second call, providing a slight performance improvement.