▲ | rocqua 5 days ago | |||||||||||||
Exceptions in Python and C are the same. The idea with these is, either you know exactly what error to expect to handle and recover it, or you just treat it as a general error and retry, drop the result, propagate the error up, or log and abort. None of those require understanding the error. Should an unexpected error propagate from deep down in your call stack to your current call site, do you really think that error should be handled at this specific call-site? | ||||||||||||||
▲ | adontz 5 days ago | parent | next [-] | |||||||||||||
Nope, exceptions in Python are not the same. There are a lot of standard exceptions https://docs.python.org/3/library/exceptions.html#concrete-e... and standard about exception type hierarchy https://github.com/psycopg/psycopg/blob/d38cf7798b0c602ff43d... https://peps.python.org/pep-0249/#exceptions Also in most languages "catch Exception:" (or similar expression) is considered a bad style. People are taught to catch specific exceptions. Nothing like that happens in Go. | ||||||||||||||
| ||||||||||||||
▲ | TheDong 5 days ago | parent | prev [-] | |||||||||||||
Yes, python and C also do not have properly statically typed errors. In python, well, python's a dynamically typed language so of course it doesn't have statically typed exceptions. "a better type system than C" is a really low bar. Go should be held to a higher bar than that. |