How do I know all thrown exceptions of a function?

Sean Reifschneider jafo at tummy.com
Sun Jan 21 01:37:59 EST 2001


On Sun, Jan 21, 2001 at 01:02:36AM +0100, Syver Enstad wrote:
>Couldn't you use the source?

Yeah, I suppose so.  I don't think you should *HAVE* to review the code of
the libraries you call, AND *EVERYTHING* that *THEY* call.  It's not an
effective use of my time...  I usually just end up leaving it and track
down what exceptions get thrown later.  Luckily, Python exceptions are
(almost) user-readable.

Exceptions is something that I think Java does right...  When you write
a method, you have to either trap all exceptions which can be generated
in it, or declare that it may throw those exceptions (so that the caller
can handle them).

Why do Python's exceptions remind me of one (frowned upon) way of
handling automatic weapons: "Spray and pray".

Sean
-- 
 One person's data is another person's program. 
                 -- Guy L. Steele, Jr.
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python




More information about the Python-list mailing list