Syntax checking python...

Ganesan R rganesan at myrealbox.com
Sat Feb 1 00:48:01 EST 2003


>>>>> "Laura" == Laura Creighton <lac at strakt.com> writes:

> Does PyChecker http://pychecker.sourceforge.net/ accomplish the same
> goals as you want?  

PyChecker is very helpful, but I find it lacking in one respect. It doesn't
catch mispelled method names in dynamic code paths. Consider this
(contrived) example:

------------

#!/usr/bin/python

import sys

if len(sys.argv) > 2:
    "hello".replce("h", "g")
#              ^^
#              note the typo here
-----------
              
PyChecker can't catch that. Considering the dynamic nature of python, I
don't know how difficult it is to catch such problems. This is not just
about typos; I am a relative newbie and tend to get method names wrong some
times. For example, when I started with python I used to make a mistake
of saying sys.argv.len() instead of len(sys.argv). If PyChecker can do
more exhaustive checks in all code paths, it would be a godsend.

Ganesan

-- 
Ganesan R




More information about the Python-list mailing list