Hacker News new | ask | show | jobs
by funkjunky 3156 days ago
"Superior error handling and easier debugging are helping it gain popularity over Python and R"

What the fuck are they talking about? I thought a "feature" of Go is that it DOESN'T have any error handling, and it forces you to catch exceptions yourself? Last I checked python already has a great solution for this built in.

2 comments

Of course Go has error handling. Thinking it doesn't shows lack of understanding of the language and its goals. Go's error handling is minimalist in order to fulfill the goal of making the code easy to read, understand and predict, in context of large software projects.

try/except in python doesn't fit that goal: looking at a line of code in python, one cannot with any reasonable level of confidence determine what types of exception could be raised, where they will be raised or if any, unless they read the documentation of the every method call that could happen by running that line.

Are you saying you prefer giant try catch blocks everywhere? I don't know python so not sure about how exceptions are handled there. I've switched from c# to go and in total I prefer go's style of error handling. The built in error type is lacking but there are plenty of packages that fill in the gaps.
If you program like that i'm sorry, you are doing it wrong. You really just need very few try catch blocks in a standard lob application, a few more if your are using some style of communication that requires it. If your code base is polluted with try blocks i think it's a mistake.