Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Python warn about bad practice and likely mistakes? [closed]

Tags:

python

Perl has the strict and warnings pragmas and a couple of CPAN modules for encouraging good style and reducing errors. Is there a Python counterpart that can help me avoid such problems and bad practices while it encourages me to use a more Pythonic structure?

I should make it clear that I do not know what I want to avoid. There is probably a lot of traps to fall into, and I'm not looking for a substitute to reading good code, reading about common errors and writing a lot, but for a complementing automated resource.

like image 570
Tim Avatar asked Jul 08 '11 19:07

Tim


2 Answers

I believe pylint (http://www.logilab.org/857) is the most most common tool used for this purpose.

like image 69
sshannin Avatar answered Sep 27 '22 19:09

sshannin


The classic style guide for Python is PEP8. If you are interested in style errors, a checker for PEP8 can be found at http://pypi.python.org/pypi/pep8.

like image 37
Ray Toal Avatar answered Sep 27 '22 17:09

Ray Toal