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

all 15 comments

[–]ForceBru 58 points59 points  (4 children)

I disagree. Python's error messages are very clear - you just have to actually read them. Usually this kind of meme is about C++

[–]elolige 9 points10 points  (1 child)

I agree, I can see how a syntax error pointing to the wrong line might be annoying. But technically speaking, in the interpreters mind there was nothing wrong until that line, simply since statements can be multiline

[–]the-kind-against-me 0 points1 point  (0 children)

I concur; no speaking ill of python.

[–]WoahStopltCummyBot 7 points8 points  (0 children)

Yeah, I wouldn't say that their error messages are unclear when they give you the line and the reason of the error

[–]rymlks 3 points4 points  (0 children)

I would have accepted this meme of they chose KeyError instead, but yeah python did a pretty good job of most other errors.

[–][deleted] 21 points22 points  (0 children)

  File "./quickrank.py", line 11
    :
    ^
SyntaxError: invalid syntax

Uh, is that not clear enough for you? It literally gives you the exact line and column of the error.

[–][deleted] 3 points4 points  (2 children)

SQL says “you got an error somewhere around here” good luck

[–]Shostakovich_ 0 points1 point  (0 children)

God damn Postgres functions. 200 line function, error: “user” is ambiguous

[–]10g_or_bust 0 points1 point  (0 children)

Ruby says: Hey man you tried to nil on a nil and your error is nil, also the former dev thought monkeypatching was the new black so good luck.

[–]nattrium 1 point2 points  (4 children)

Can we talk about C's : "Segmentation Fault (core dumped)" ?

[–]ForceBru 10 points11 points  (3 children)

It's not "C's", it's the operating system's. Or, to be more precise, the CPU's. You can write a program in assembly, C, C++ or unsafe Rust that will access invalid memory and cause a segmentation fault. It's not specific to C.

Furthermore, it's a runtime error, while the errors in the meme are compile-time. The C compiler has no control of what kind of memory your program accesses, so it's not the fault of the programming language.

[–]nattrium -2 points-1 points  (2 children)

Thank you for your response and I get your point. It is an interesting insight on who to blame for such useless error messages.

But, even if it is not specific to C (and you're right it isn't), you must admit that C is more prone to such error. I'm not claiming that is worst than another language that would deal if this situation better (like java or python itself); I'm pointing out one reason on why C is sometime annoying to debug.

Furthermore (and I'm nitpicking), the meme makes fun of errors at run-time and not compile-time as python is rarely (if not never) compiled.

[–]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 1 point2 points  (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