PyChecker does STATIC analysis?

Diez B. Roggisch deetsNOSPAM at web.de
Wed Apr 28 12:29:00 EDT 2004


beliavsky at aol.com wrote:
> before finding the out-of-bounds error. I have seen PyChecker
> described as a "static analysis" tool, and it does find some problems
> that such a tool ought to. But it seems that for the simple program I
> have shown, it basically runs the program, and I could just run the
> Python program to find the same errors. An aspect of Python
> programming that sometimes frustrates me is that a program will run,
> perhaps for a few minutes, before stopping because of a misspelled
> variable or an out-of-bounds variable. It seems that currently,
> PyChecker will not solve this problem. I wish there were a tool that
> did (and would be willing to pay for it).
> 
> The Lahey/Fujitsu Fortran 95 compiler is able to catch the
> out-of-bounds error at COMPILE time for an analogous Fortran program.

while there might be not-so-obvious cases that can be found using static
analysis, the halting problem also applies here: There is no such thing as
a automated analysis that finds out if your prgram is going to die or not.

So automatically running a program as part of the analysis is as valid as
any other technique - as long as there are no permantent sideeffects (you
don't want your partitioning code accidentially ruin your hd while
developing...)

Given the fact that nobody prevents you from doing this:

>>> xrange = lambda x: [1,2,3,4,5]
>>> x = range(3)
>>> print x[3]
4

you can fool a static analysis, I wont blame Pychecker too much.


-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list