A proposal for java's "throws" in python: Extend type hints to cover exceptions
https://programming.dev/post/5934266

A proposal for java's "throws" in python: Extend type hints to cover exceptions - programming.dev
This is a discussion on Python’s forums about adding something akin to a throws
keyword in python.
When I used to write Java and switched to Python, this was one of the things I missed. It was always quite clear which exceptions I had to catch (or not). Just today, I ran into the issue of trying to cover the exceptions a library could throw without using except: or except Exception as e, but finally gave up and gave in to it. The linter wasn’t happy, but fuck it.