5 ms·
This is the first time I ever heard someone complain about Python's error messages in the 10+ years I've been using it. Even people who just learned it, pick up
by dec0dedab0de 4y ago
This is the first time I ever heard someone complain about Python's error messages in the 10+ years I've been using it. Even people who just learned it, pick up reading tracebacks after about a day of practice. The only problem I ever see is if a library swallows too much, and gives a generic error, but that's not something the language can fix. I really hope they don't change things too much.
- joshmaker 4y agoThe new error messages are much better. Take a look at this example: Traceback (most recent call last): File "calculation.py", line 54, in <module> result = (x / y / z) * (a / b / c) ~~~~~~^~~ ZeroDivisionError: division by zero In this new version it's now obvious which variable is causing the 'division by zero' error. https://docs.python.org/3.11/whatsnew/3.11.html#enhanced-error-locations-in-tracebacks https://docs.python.org/3.11/whatsnew/3.11.html#enhanced-err...
- bredren 4y agoFor a lot of folks dealing with getting something working, its way more useful to have the most likely spot where the error is occurring spit out for them like this. Stack trace is useful, especially in understanding how the code is working in the system. But if the goal is solve the problem with the code you've been working on, existing traces are way too verbose and if anything add noise or distract from getting to productive again. I could see tracebacks get swifty terminal UI that shows only the pinpointed error point that can be accordion'd out to show the rest.
- actuallyalys 4y agoI don’t think they’re that bad, but I think the bar has (fortunately) become higher.
- urthor 4y agoExactly right. The old Python stack trace, circa 2015, was the best in the world. The new ones are even better. The gap between Python and Rust, and the JVM languages/C/C++, is increasingly widening. Stack trace is one of the areas Python and Rust are making the case for why they're the languages of the future.
- e-master 4y agoI only rarely delve into the python world, but as a .net developer I always found it odd and confusing that the error message comes after the stack trace in python. I don’t see people complaining about it, so maybe it’s just a matter of habit?
- kzrdude 4y agoI guess it's just a habit even if I think it's mildly confusing too. But: it's kind of a virtue that the most important error message comes last. Far too many (ahead of time) compilers output too many errors. The most likely error to matter is the first one, but it is often scrolled way off screen; the following errors might even just be side effects that mislead or confuse the new users.
- AdamN 4y agoOn the CLI, you'll see the error just above the prompt and then the stack trace above that. It makes sense since the user is always reading up the terminal in reverse order.
- dx034 4y agoYou've clearly been working with the right people. I constantly get screenshots of error messages (not even the text of the traceback so that I could copy it) with questions about what that means. It takes some training for people to be able to read tracebacks correctly, especially if they have no other programming experience.