Pylint Argument number differs from overridden method

Jean-Michel Pichavant jeanmichel at sequans.com
Thu Mar 4 11:45:19 CET 2010


Wanderer wrote:
> On Mar 3, 2:33 pm, Robert Kern <robert.k... at gmail.com> wrote:
>   
>> On 2010-03-03 11:39 AM, Wanderer wrote:
>>
>>     
>>> Pylint W0221 gives the warning
>>> Argument number differs from overridden method.
>>>       
>>> Why is this a problem? I'm overriding the method to add additional
>>> functionality.
>>>       
>> There are exceptions to every guideline. Doing this could easily be a mistake,
>> so it's one of the many things that Pylint checks for. Silence the warning if
>> you like.
>>
>> --
>> Robert Kern
>>
>> "I have come to believe that the whole world is an enigma, a harmless enigma
>>   that is made terrible by our own mad attempt to interpret it as though it had
>>   an underlying truth."
>>    -- Umberto Eco
>>     
>
> Thanks I was just wondering if I was overlooking something about
> inheritance.
>   
This is only my opinion but you get this warning because of 2 disctinct 
issues:
1/ you just made a basic mistake in your signature and need to correct it
2/ you did not make any mistake in the signature, but this warning may 
reveal a (small) flaw in your class design.


I don't know the exact context for your code, but it's better to have a 
consistant interface over your methods and mask the implementation 
details from the user.
In your case, the getRays method may always ask for the lambda 
parameters and just ignore it for one of its implementation.

And don't write empty doctrings to trick pylint. Either write them, or 
remove this rule, you are loosing all the tool benefits.


JM





More information about the Python-list mailing list