Search code examples
pythonpylint

Linting Python: what is good?


Are there any good modules that you can run against your code to catch coding errors? I expected pylint to catch mistakes in the use of default arguments to functions like this:

>>> def spam(eggs=[]):
...     eggs.append("spam")
...     return eggs

but was disappointed to find them unreported. I am looking for something beyond PEP8 formatting.


Solution

  • I tried the first example and PyLint 0.18.1 gave me the warning:

    W:  1:spam: Dangerous default value [] as argument