News for hackers. Stuff that matters.
Re:Long Error Messages by BiteCode_dev on Wednesday September 22, 2021 @12:59PM (#28618740)
Next python release (3.10) made a lot of noise because it introduced pattern matching.

But I'm very excited about this upcoming version for a very different reason: they made a huge work on error messages!

Check this out: https://docs.python.org/3.10/whatsnew/3.10.html#better-error...

Syntax errors are more precisely reported, AttributeError/NameError suggest a spelling correction, IndentationError will pinpoint where you screw up...

And yes, a good IDE already does that for you, but a lot of Python dev are using a ligth text editor or just a shell/notebook.

This, to me, is progress! Unsexy, warmly welcome progress.

Re:Long Error Messages by Igelau on Wednesday September 22, 2021 @01:17PM (#28619015)
> Syntax errors are more precisely reported, AttributeError/NameError suggest a spelling correction, IndentationError will pinpoint where you screw up...

Helpful, but I can't help but think of Java's syntax errors when you forget a semicolon. If the compiler knows what you meant, then it knows what you meant. That points to the syntax having extra baggage it doesn't really need.

Re:Long Error Messages by BiteCode_dev on Wednesday September 22, 2021 @01:34PM (#28619240)
It doesn't know. You can identify a wrong answer without knowing the right one.

I can tell you 1 + '1' is wrong in python, but can't tell what you meant.

Re:Long Error Messages by tialaramex on Wednesday September 22, 2021 @01:58PM (#28619565)
Sometimes it has a pretty good idea.

Typo correcting is an excellent example of this. I don't want my program to compile and run if I wrote "taxis" when I meant "taxes". I want an error. Taxis is wrong. But if the diagnostic says "Did you mean taxes?" that's great because it calls attention to the most likely mistake.

I'd say if the machine has a suggestion that it knows would work (but could be wrong) it's better to mention what that suggestion is than keep silent, but it would be worse to just press on as if that's what you wrote.