3 ms·
Incorrect. Consider a file test.py: print "hello" x = 1 + Note the syntax error. Running it, we see: $ python test.py File "test.py", line 2
by mgreenbe 17y ago
Incorrect. Consider a file test.py:
print "hello"
x = 1 +
Note the syntax error. Running it, we see:
$ python test.py
File "test.py", line 2
x = 1 +
^
SyntaxError: invalid syntax
If syntax errors were runtime errors, we would see the effect of the print statement. This is not a top-level effect: the same is true even if a syntax error is under a function.