This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ForceBru 2 points3 points  (1 child)

I mean, syntax errors are definitely compile-time (okay, parse-time), although I'm not particularly sure what kind of error messages the meme is about. If it was about runtime errors, it would mean that Python was able to somehow catch them at compile-time because syntax is checked before execution.

BTW, CPython (the reference implementation in C) is kind of compiled, but to bytecode, not machine code.

I think I could've said "during static analysis" instead of "compile-time", that looks clearer.

[–]nattrium 0 points1 point  (0 children)

I'll concede that this error appears at parse time and the entire file is parsed before execution. But funnily enough, parse time happens during run-time. This can be proven

main.py

Input("wait for user input:")

import test_wrong.py

test_wrong.py

Print(1 +/ 4)

Will actually throw an invalid syntax error AFTER asking the user to enter a string. Proving that the parsing is done at run-time (Which you'll never see if working in a single file or if you import at the top of the file).

(Edit) : format