How to determine what exceptions a method might raise?

Ben Finney bignose+hates-spam at
Tue Jan 16 23:16:34 CET 2007

Ed Jensen <ejensen at> writes:

> 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).

For what purpose would this be handy? Surely the benefit of the
interactive interpreter is that you can simply try it out and *see*
what happens.

But, in case it helps: Any code may raise any exception at any
time. This is a feature, since it encourages program that are tested

 \                      "I'm a great lover, I'll bet."  -- Emo Philips |
  `\                                                                   |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list