documenting excepetions in Python

Nikita the Spider NikitaTheSpider at
Fri Oct 19 18:14:25 CEST 2007

In article <1192807949.182072.69370 at>,
 dale_bertrand at wrote:

> In python, how do I know what exceptions a method could raise?  Do I
> need to look at the source?  I don't see this info in the API docs for
> any of the APIs I'm using.

Hi Dale,
Usually the docs for a method will list the likely exceptions, but 
there's no way to know the full list of possible exceptions except by 
testing, testing, testing. Obviously, there's always a chance that 
there's a test you didn't think of and therefore an exception 
unaccounted for. I think this is a less-than-ideal aspect of Python but 
I don't have a suggestion on how to improve it.

Good luck

Whole-site HTML validation, link checking and more

More information about the Python-list mailing list