On Fri, 09 Jun 2006 11:46:59 -0700, Matt Good wrote: > Anthony Greene wrote: >> Howdy, I had the impression that pychecker caught and reported such >> dynamic syntactical errors. >> >> #!/usr/bin/env python >> >> >> def add(i): >> i += 10 >> >> status = 3 >> >> if 1 == 1: >> statuss = 15 >> >> add(status) >> >> ======================= >> >> exalted sysfault$ pychecker foo.py >> Processing foo... >> >> Warnings... >> >> None >> >> ======================= >> >> Hence the mispelling of status (statuss), which was done purposely to test >> if pychecker will acknowledge and report the error. Do i need to enable >> some type of pychecker option in order for it to pick up the error? I know >> that it is syntactically correct in python, however it's likely that >> 'status' is meant. Am i wishing that pychecker will replace a statically >> typed language mechanism? > > That's a functional error, not a syntactical one. Analyzing the > spelling of variables for similarity would lead to a lot of incorrect > warnings since pychecker has no way to tell this apart from intentional > similar spellings such as: > > values = [1, 2, 3] > value = values[0] > > However, when the misspelling is made inside a local scope, rather than > at the module level a warning is reported "test.py:8: Local variable > (statuss) not used": > > def add(i): > i += 10 > > def test(): > status = 3 > if 1 == 1: > statuss = 15 > add(status) > > > This is why tools like pychecker (or pyflakes, pylint, or even a static > code compiler) aren't a substitute for unit tests. They can definitely > help catch common mistakes, but they can't ensure your code does what > you intended.
Thanks guys, exactly what was needed. -- A wise man knows he knows nothing. -- http://mail.python.org/mailman/listinfo/python-list