I have the following python code
a = 2
if a == 1:
b = 'blah'
print b
else:
print b
When I try to run it, I get a runtime error, since "b" is defined only in the "if" section, not the "else" section.
Pylint and Pyflakes were both unable to detect this problem.
Is there any other way to detect it without running the code?
source
share