How do I know all thrown exceptions of a function?

Remco Gerlich scarblac at pino.selwerd.nl
Wed Jan 24 18:38:32 EST 2001


Donn Cave <donn at u.washington.edu> wrote in comp.lang.python:
> Do rules, even "rules of thumb", help us write code that makes sense?
> I don't know, but it's not easy to come up with a good rule of thumb!
> Obviously the real quality of a system depends on the effort and insight
> the programmer brings to bear on it.
> 
> I'm not sure it's clear that a programmer must have an inventory of
> potential exceptions.  For common programming applications, I think
> we trap exceptions because we think we can do something appropriate,
> because we think we understand the nature of that problem.  A list
> of names of exceptions isn't enough, we need to understand the exceptions
> in terms of the problems they represent in that context.  I don't think
> you can make a list of exceptions, for any non-trivial function, that
> can possibly be both complete and meaningful.


I suppose the rule of thumb is "whatever you do, think about it, keep it
simple, and document it well.", as usual.

Which is sort of what we thought beforehand. But I like the discussion :)

-- 
Remco Gerlich



More information about the Python-list mailing list