I’m not sure if the ability to tell would help. Just like typing hints are very much optional in Python, I don’t expect many libraries to get their exception declarations right. Especially if there are transitive dependencies
I write Java code for my day job and while throws has been part of the language for ages, Java developers seem intent on avoiding it at all costs.
I would welcome a throws in Python so that libraries and coworkers that do the right thing are easier to work with, but I don’t think it’d solve the underlying issue in most cases.
I’m not sure if the ability to tell would help. Just like typing hints are very much optional in Python, I don’t expect many libraries to get their exception declarations right. Especially if there are transitive dependencies
I write Java code for my day job and while
throws
has been part of the language for ages, Java developers seem intent on avoiding it at all costs.I would welcome a
throws
in Python so that libraries and coworkers that do the right thing are easier to work with, but I don’t think it’d solve the underlying issue in most cases.I believe raises is the de facto Python version of
throws
, but no tools seem to exist to actually handle it.that’s still a docstring, idk of linters that take docstrings into account at all. We need a semantic approach for this kind of annotation.
That’s way harder to ask for. A docstring solution is fine so long as the linters know to pick it up.