Are there syntax checkers able to detect broken code based on edge cases. An example:
def run():
for j in [0, 1]:
if j == 0:
yield j
else:
yield None
for i in run():
print i * 2
This code is broken because None * 2
does not make sense. Are there tools to detect this kind of error ?
Thank you
You're looking for a type checker, not a syntax checker. Here's one attempt to make one: http://mypy-lang.org/