Reputation: 3542
One of the most frustrating things about programming in Python
thus far has been the lack of some kind of "pre-analysis". In Java
, for example, a pre-analysis is performed before the actual compilation of a program, in which things like name usage is checked. In other words, if I have called a variable list_one
in one area, and say I mispell it as list_on
in another area, Java will say "Hey you cant do that, I dont know what list_on
is."
Python
does not seem to do this, and it is terribly frustrating! I have a program that takes about 15 minutes to run, and the last thing I was to see at 14.5 minutes into it is something like
NameError: name 'list_on' is not defined
Are their any tools available out there can can perform this kind of check before the interpreter actually runs the program? If not, what are some ways to work around this issue?
Upvotes: 1
Views: 80
Reputation: 3542
UPDATE
I found a fantastic solution to this problem for those that happen to be emacs
users. You can install PyFlakes-Flymake. This is a great tool! It will perform a static analysis of your code on the fly, and highlight trouble areas in red. I suggest using PIP
instead of the suggested easy_install
. Other than that, it is pretty simple to get it up and running. And well worth the effort!
Upvotes: 0
Reputation: 899
Have you considered checking your code with something like pyflakes or pylint?
Upvotes: 2