Improve Your Python Code With pylint

By | August 11, 2015

The myriad recommendations and requirements of the Python Style Guide can be bewildering and difficult to remember for the uninitiated.  Pylint is a Python application that analyses your code and suggests where you could make it more readable and more inline with the Python style guide.

Pylint takes much of the hard work out of using these conventions, by pointing out things like:

  • Missing docstrings in classes/functions
  • Checking variable, class and function names
  • Checking your code’s line length

As you work through Pylint’s list of suggestions it will update its 10-point evaluation to let you know how well-styled and readable your code is.

improve your python code - pylint window

These are all things that we should ideally be keeping on top of as we go along, but of course we will always slip at some point. The more you use pylint, the more familiar you will become with the python style conventions, and before long you’ll find you are writing much better and more readable code first time, without having to run pylint first.

Pylint is easy to install and readily integrated into commonly used Python IDEs such as Spyder/Anaconda, Eclipse/PyDev, or PyCharm so it’s easy to use Pylint as you write.

improve your python code