[Python-projects] pylint false positive: Unused argument/variable on "-="

skip at pobox.com skip at pobox.com
Thu Mar 26 01:20:57 CET 2009


    Maarten> Another false positive. Again, I think it is new, but not 100%
    Maarten> sure.

    Maarten> ===
    Maarten> def exclude(setA, setB):
    Maarten>    setA -= setB
    Maarten> ===
    Maarten> W0613:  1:exclude: Unused argument 'setA'

    Maarten> Or a variant with a local variable instead of an argument:
    Maarten> ===
    Maarten> def exclude(func, setB):
    Maarten>    setA = func()
    Maarten>    setA -= setB
    Maarten> ===
    Maarten> W0612:  2:exclude: Unused variable 'setA'

    Maarten> It seems that the left side of "-=" is not considered a use of
    Maarten> the argument/variable.

I think pylint is doing the correct thing here.  You set setA and change its
value but never use it to affect the state of the system (other than setA's
value itself).

-- 
Skip Montanaro - skip at pobox.com - http://www.smontanaro.net/


More information about the Python-Projects mailing list