documenting excepetions in Python

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


In article <1192807949.182072.69370 at y27g2000pre.googlegroups.com>,
 dale_bertrand at yahoo.com 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

-- 
Philip
http://NikitaTheSpider.com/
Whole-site HTML validation, link checking and more



More information about the Python-list mailing list