Please run a linter on your Python code before checking it into the stack. Unlike C++, many Python errors will not show up until a particular branch of code is executed. Running a linter can catch many errors that might otherwise be missed.
The two most common linters are pyflakes
and flake8
. The latter adds PEP-8
style checking, which can be useful once you configure it to eliminate false warnings. pyflakes
catches important errors such as trying to use a variable that has never been defined. It also warns you of unused imports and setting variables that are never used, and rightly complains about from foo import *
Many editors support automatic live linting of Python code, including Emacs
, Sublime Text
and Atom
. I strongly using automatic linting if your editor supports it, the linting is more likely to occur and you will catch errors earlier.