Avoid expressions that always evaluate to the same value

This code will always evaluate the same value regardless of the inputs.

It looks like the if statement will either always evaluate to True or always evaluate to False regardless of what inputs are used.

This is probably a typo or perhaps the code was for debugging and should not have been committed.

If our GitHub code review bot spots this issue in your pull request it gives this advice:

code-review-doctorbotsuggested changes just now
helpers.py
1
+
if value == 1 and False:
2
+
    foo_bar()

This code will always evaluate the same value regardless of the inputs.

Read more
Update helpers.py
We're your Python code review copilot. Get code improvements right in your pull request with our GitHub code review bot.

Configuring this check

Code Review Doctor will run this check by default. No configuration is needed but the check can be turned on/off using check code avoid-static-if-condition in your pyproject.toml file.

Read more about configuring Code Review Doctor.

Reading list