I think false positives come from names that aren't defined in conditionals that are used afterwords, like
if something:
i = 0
else:
# i not defined
if something:
f(i)
else:
# code that doesn't use i
If Pyflakes warned that the first else block didn't define i it would be a false positive, because i is never accessed when the code reaches that control flow.
But in this case, the variable is not defined *in* the conditional block. I don't see how that could be a false positive. So it's a distinction between
- Variables defined in only a subset of conditionals, and used below (fine)
- Variables used in a conditional that aren't defined above (not fine)
I think false positives come from names that aren't defined in conditionals that are used afterwords, like
if something:
i = 0
else:
# i not defined
if something:
f(i)
else:
# code that doesn't use i
If Pyflakes warned that the first else block didn't define i it would be a false positive, because i is never accessed when the code reaches that control flow.
But in this case, the variable is not defined *in* the conditional block. I don't see how that could be a false positive. So it's a distinction between
- Variables defined in only a subset of conditionals, and used below (fine)
- Variables used in a conditional that aren't defined above (not fine)