documenting excepetions in Python

kyosohma at gmail.com kyosohma at gmail.com
Fri Oct 19 17:44:49 CEST 2007


On Oct 19, 10:32 am, dale_bertr... 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.
>
> Thanks in advance for your help.

Read the source, run unit tests, etc. If you write your own methods,
you might consider writing tests beforehand: http://en.wikipedia.org/wiki/Test-driven_development

Sometimes the module's docs will tell you the likely return values,
which can help you know what exceptions to look out for.

Mike




More information about the Python-list mailing list