3 ms·
> Verbose and repetitive error handling If you were to handle the same error cases in Python that you gave examples for in Go, it would probably be even more v
by james4k 14y ago
> Verbose and repetitive error handling
If you were to handle the same error cases in Python that you gave examples for in Go, it would probably be even more verbose with the try/catch wrapped around.
> Errors passing silently – ticking time bombs to go
Are you kidding? Unless exceptions are documented well, which they rarely are, this is a much greater problem when using exceptions.
- je42 14y ago> If you were to handle the same error cases in Python that you gave examples for in Go, it would probably be even more verbose with the try/catch wrapped around. Not sure what you are talking about: try: datastore.Get(c, key, record); viewTemplate.Execute(w, record); catch e: appError(e);
- wonderzombie 14y agoIs catching all exceptions really what you wanted to do here? A generic appError() is not equivalent to handling each possible failure more by type, as the Go example does.
- je42 14y agoMy bad. Good point. I looked at what he meant - not what he wrote. :)
- lmm 14y ago>Are you kidding? Unless exceptions are documented well, which they rarely are, this is a much greater problem when using exceptions. No it's not. If you get an exception you didn't prepare for, your code fails, not silently but very loudly. The argument to have is whether this is better or worse than your code silently continuing to do all the next steps even though the first one failed. (FWIW I agree with the article, but will say it's kind of surprising to see that point of view from a python programmer given the python approach to type-checking)