lint for Python?

Pat Pat at junk.com
Mon Oct 6 15:49:43 EDT 2008


Bruno Desthuilliers wrote:
> Pat a écrit :
>> 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
> 
> Nope, but even the most simple manual test should find it pretty quick.
> 
>> and it won't be caught until it's called while the program is 
>> running.  I don't want that error found at 3AM.
> 
> Don't you ever test your code ???
> 
>> I've never used a language that didn't catch that type of error.
> 
> It does. Just try to run your code, and you'll have a nice traceback. 
> Unless of course 'foo' is rebound in module two to another callable 
> expecting only two parameters...
> 
>>  I'm quite surprised that Python is being used by a number of major 
>> companies.
> 
> Perhaps do they rely more on testing and less on the compiler ? FWIW, 
> I've seen my share of bugs in declarativly statically typed languages, 
> and most of them were way nastier (and way less obvious) than the above 
> one.
> 
>>  How you catch these types of errors?
> 
> Just like any other type of errors : testing, testing, and then add some 
> more tests.
> 

I haven't gotten into unittesting.  I've just started learning Python.

It also dawned on me why my original question is a bit lame.  Python 
supports default arguments; something that is new to me.  How could lint 
possibly know the correct number of arguments passed to it?  Unless, of 
course, lint knew which functions had default arguments or not.

I'll come back with more intelligent questions after I've actually 
learned some Python.



More information about the Python-list mailing list