Skip to content

Generated Python for if and let* forms includes redundant assignment in many cases #793

@chrisrink10

Description

@chrisrink10

The generated Python for if forms always includes an assignment like the below regardless of whether or not the original value of if_test is already a name. The code is generated like this to ensure we are only ever computing a value once for testing an if expression, but this is redundant if the expression we're getting is already a name.

if_test = "some expr"
if None is if_test or False is if_test:
    ... # false cond
else:
    ... # true cond

Likewise, let* forms always set the final result to a Python variable let_result, but if that result is already a name it should be necessary.

Metadata

Metadata

Assignees

Labels

component:compilerIssue pertaining to compilerperformanceIssue pertaining to performance

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions