"Compile time" checking?

Qopit russandheather at gmail.com
Wed Aug 10 11:53:15 EDT 2005


Hi there,

I'm pretty new to Python and am trying to figure out how to get "will
this code compile?"-like code checking.  To me this is a pretty basic
language/environment requirement, especially when working with large
projects.  It is *much* better to catch errors at "compile-time" rather
than at run-time.

One thing I've "found" is the PyChecker module (conveniently embedded
in SPE), but it doesn't seem to do that great of a job.  For example,
the following simple program checks out perfectly as far as PyChecker
is concerned:

#----
def tester(a,b,c):
  print "bogus test function",a,b,c
tester(1,2,3)  #this runs fine
tester(1,2)    #this obviously causes a run-time TypeError exception
#----

It seems to me that this should be an obvious catch for PyChecker.  I
suppose you could argue that you don't want PyChecker to bark at you
any time an exception would be raised since you may intentionally be
causing exceptions, but this one seems a pretty simple and obvious one
to catch.

My questions are:
- Am I missing something with my tester example?
- Are there other code-checking options other than PyChecker?

Any other comments appreciated (aside from things like "just right good
code that doesn't have bugs like that" :) ).

Thanks!




More information about the Python-list mailing list