a=200
def main():
 b=300
 if(a==v):
   b=500
 return (b+c)
 
Should not the compiler give me syntax errors for the above code.
I place this in a file "d:/test.py"
Then when I do py_compile.compile('d:/test.py') I donot see any syntax error.
 
Why is this so? Please notice that v and c are not defined or assigned any value.
Is there any way I can force the compiler to throw syntax error in such condition?
Is there any way I can force the compiler to accept only typed variables?
That way the compiler will always catch undeclared variables as syntax error.
 
Thanks,
Dipankar