How to determine what exceptions a method might raise?

Harlin Seritt harlinseritt at yahoo.com
Tue Jan 16 15:03:33 EST 2007


Hi Ed,

Generally checking the sources give a very good clue as to what
exceptions the interpreter can raise. Look around _builtins_ for this.

Harlin Seritt


Ed Jensen wrote:
> I'm really enjoying using the Python interactive interpreter to learn
> more about the language.  It's fantastic you can get method help right
> in there as well.  It saves a lot of time.
>
> With that in mind, is there an easy way in the interactive interpreter
> to determine which exceptions a method might raise?  For example, it
> would be handy if there was something I could do in the interactive
> interpreter to make it tell me what exceptions the file method might
> raise (such as IOError).
> 
> Thanks in advance.




More information about the Python-list mailing list