PyChecker is a valuable tool to use to check and debug your Python code. This tool is especially useful to have if you’re just beginning to learn the language — trying, failing, and learning from your mistakes is often the best way to learn to code! Luckily for beginner coders, PyChecker is very easy to install and use.
Here’s how it works: PyChecker imports each module, and if it finds an error in the module, it won’t complete the import. According to the documentation, the typical types of problems that PyChecker looks for are:
- No global found (e.g., using a module without importing it)
- Passing the wrong number of parameters to functions/methods/constructors
- Passing the wrong number of parameters to builtin functions & methods
- Using format strings that don't match arguments
- Using class methods and attributes that don't exist
- Changing signature when overriding a method
- Redefining a function/class/method in the same scope
- Using a variable before setting it
- self is not the first parameter defined for a method
- Unused globals and locals (module or variable)
- Unused function/method arguments (can ignore self)
- No doc strings in modules, classes, functions, and methods
PyChecker produces four different types of error warnings:
- Likely bugs
- Potential bugs
- Unused identifiers
- Code complexity/style
A debugger this versatile and dynamic is definitely a good tool to have at your disposal — even if you’re new to Python. If you’re looking for a debugger but PyChecker isn’t for you, why not check out pyflakes (https://pypi.python.org/pypi/pyflakes), a similar Python project.