For this Rust style error handling can be interesting, eg using poltergeist (https://github.com/alexandermalyga/poltergeist) or result (https://pypi.org/project/result/).
For this Rust style error handling can be interesting, eg using poltergeist (https://github.com/alexandermalyga/poltergeist) or result (https://pypi.org/project/result/).
With normal exceptions, I have to use my meat brain to figure out if I've handled all the exceptions that might come up, whereas mypy can just tell me if I've handled the result object correctly
That said, I don't use either library since, in my experience, you need them to be used all the way down the stack to actually get the benefit.
The point of exceptions is exactly that you don't want to handle all that might come up -- you need to handle only those that you actually expect and know how to handle. Everything else is left to bubble up and either be handled by a custom, generic top-level handler, or by the language's default mechanism (in Python's case, dumping a stack trace).