lint for Python?

George Sakkis george.sakkis at gmail.com
Sat Oct 4 15:12:49 CEST 2008


On Oct 3, 5:38 pm, Pat <P... at tanker.net> wrote:

> I've been searching for a good multi-module lint checker for Python and
> I haven't found one yet.
>
> Pylint does a decent job at checking for errors only within a single module.
>
> Here's one of my problems.  I have two modules.
>
> In module one, I have a function:
>
> def foo( host, userid, password ):
>      pass
>
> In module two, I call that function:
>
> foo( userid, password)
>
> lint doesn't find that error and it won't be caught until it's called
> while the program is running.  I don't want that error found at 3AM.
>
> I've never used a language that didn't catch that type of error.  I'm
> quite surprised that Python is being used by a number of major
> companies.  How you catch these types of errors?

With a decent testing suite of course. Even if this specific issue
might be handled more or less by a lint-like tool (which is not
trivial in a dynamic language since the f() used in module2 might not
even be the function you think it is), there are dozens more potential
errors that can't be checked, e.g. changing the order and/or the
expected type of the arguments. There is no substitute of testing, and
while this is true in statically typed languages too, it's even more
critical in dynamic languages.

George



More information about the Python-list mailing list