Is there any way to programmatically determine which exceptions an object or method might raise?
Like dir(obj) lists available methods, I’m looking for the equivalent dir_exceptions(obj).
As far as I know, the only way to achieve this would be to parse the source.
I don’t think this is possible. An exception is a runtime phenomenon and you’ll know what it possible (or what happens) only while running. Why would you want to do this though?