Python Code Auditing Tool

Diez B. Roggisch deetsNOSPAM at web.de
Wed Feb 2 04:30:25 EST 2005


> I suppose that I am willing to lessen my expectations from _all_ to most.
> ;-) Regarding your example I could also do:
> 
>     if something():
>         def nothing(): return 0
>     else:
>         def nothing(): return 1
> 
> But this doesn't stop IDEs from attempting to do auto-completion.  I'm not
> trying to find hidden exceptions... just trying to easily get an idea of
> what could go wrong on each line of code.

There is AFAIK only one language that this can de accomplished - java, and
that's because of these checked exceptions of theirs. But checked
exceptions are considered harmful:

http://www.gcek.net/ref/books/sw/ooad/tip/#_Toc41169682

I totally agree with that - in java, I tend to throw SystemExceptions to rid
myself of endless try/catch clauses that obscure the real problem.

So - there is no way of knowing this. The only thing I can think of is to
keep some docs around that specify what exceptions to be expected, and that
tool of yours could try and see if it can identify a function/method by
name and notify you of the possible exceptions thrown. Might actually work
out quite well for the standardlib, if one does the work for annotating all
functions/methods properly.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list