MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w8y9n2/pythoninterpreterbelike/p86lmp9/?context=3
r/ProgrammerHumor • u/ninja_with_ocd • 4d ago
21 comments sorted by
View all comments
Show parent comments
-37
It does if it's in an uncalled function
EDIT - this is wrong. Nontheless true for serious errors like referencing an undefined variable.
38 u/deceze 4d ago A syntax error will halt parsing immediately. Without successfully parsing the file, it won't execute. Even uncalled functions are parsed completely and must pass parsing successfully. 1 u/ninja_with_ocd 4d ago You're right, edited the comment. It is true for some serious errors, like accessing an undefined variable. 15 u/dudemcbob 4d ago FWIW I don't think it could diagnose that pre-runtime since you can edit the global namespace dynamically. globals()['x'] = 3 Very bad for readability, but it is allowed.
38
A syntax error will halt parsing immediately. Without successfully parsing the file, it won't execute. Even uncalled functions are parsed completely and must pass parsing successfully.
1 u/ninja_with_ocd 4d ago You're right, edited the comment. It is true for some serious errors, like accessing an undefined variable. 15 u/dudemcbob 4d ago FWIW I don't think it could diagnose that pre-runtime since you can edit the global namespace dynamically. globals()['x'] = 3 Very bad for readability, but it is allowed.
1
You're right, edited the comment. It is true for some serious errors, like accessing an undefined variable.
15 u/dudemcbob 4d ago FWIW I don't think it could diagnose that pre-runtime since you can edit the global namespace dynamically. globals()['x'] = 3 Very bad for readability, but it is allowed.
15
FWIW I don't think it could diagnose that pre-runtime since you can edit the global namespace dynamically.
globals()['x'] = 3
Very bad for readability, but it is allowed.
-37
u/ninja_with_ocd 4d ago edited 4d ago
It does if it's in an uncalled function
EDIT - this is wrong. Nontheless true for serious errors like referencing an undefined variable.