-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
acceptedReady for implementationReady for implementationruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
If you want to make your software package run with the python -O optimization, you might want to ensure that the code does not contain a walrus assignment in assert statements:
y = 0
assert (x := y) is not None
x = x + 1This code example runs fine normally, but if run with python -O the assertion gets removed and the program raises a UnboundLocalError because x is no longer bound.
As a developer, I might want to configure my linter in such a way that walrus assignments are not allowed in assertion statements. This way, I can enforce that the code will be compatible running with python -O.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
acceptedReady for implementationReady for implementationruleImplementing or modifying a lint ruleImplementing or modifying a lint rule