3 ms·
Many times I've had to say NO DONT DO THAT! to people writing giant try/except blocks in Python. Usually the answer is to wait for an actual exception and if
by dec0dedab0de 7y ago
Many times I've had to say NO DONT DO THAT! to people writing giant try/except blocks in Python.
Usually the answer is to wait for an actual exception and if it's not something you could actually anticipate, then write a tiny try block that just handles the exception. The whole point being that I want it to fail if there is an unknown exception. Which in Go, you wont fail at runtime if you are just printing errors as a habit( I think, I have not done much with go).
That said, a lot of times it makes sense to return errors, and perhaps there in lies the difference between an exception and an error.
- superbaconman 7y agoMassive try catch statements introduce excessive indentation, and moves the handling logic away from what's being handled. It's hard to believe that this would be common practice among anyone with a few years under the belt.