Python Code Auditing Tool
Diez B. Roggisch
deetsNOSPAM at web.de
Wed Feb 2 05:50:32 EST 2005
Hi,
> I'm afraid that the only reliable way to gather what exceptions are
> raised is to read docs and/or come up with test cases. This has been a
> bugbear of mine in Python as it's not common to find a nice :Exceptions:
> IOError <desc>, IllegalArgumentError <desc> type of description in the
> docs.
>
> However if you want an incomplete test, you could parse the code and
> check for raises and retrieve the class name of the exception - however
> this would be patchy at best. Therefore it would sort of negate the
> point of doing the analysis in the first place.
I don't want that - the OP wants. I agree with you.
> Even in Java you cannot find every exception that will be
> thrown, only 'checked' exceptions but this is a percentage of all the
> exceptions (BTW why do you throw SystemException - it's a CORBA
> exception! OK, it's a runtime exception but why not just simply extend
> RuntimeException?). Also, if someone ever puts - catch (Exception e){}
> in their code they deserve to be kneecapped, IMHO the fault is with
> sloppy coding not with the supplied tools.
Most probably I throw RuntimeException - that was out of my head, I luckily
I haven't been coding java too much lately :)
> Unfortunately its docs and testing again, that's why we get paid (if
> you're doing a job) or not paid (if you're doing it for fun!). Although
> one language which comes closer is Eiffel which has require and ensure
> clauses on every method (following Meyer's Programming by contract
> philosophy).
Full ack again.
--
Regards,
Diez B. Roggisch
More information about the Python-list
mailing list