Hi, I've been looking at pylint ticket #9263<https://www.logilab.net/elo/ticket/9263>(no W0613 for __init__ (method does not use all of its arguments)). It looks like the problem occurs in the variables checker, at line 243, when the checker gives the method a pass if it's in PYMETHODS, a set of special Python functions. __init__ is in PYMETHODS, so it's never subject to W0613 warnings. I think the check is still valuable for almost all other methods in PYMETHODS, where the number of arguments is fixed. For example, it seems reasonable that someone might want to define some object with infinite magnitude, and override its __ge__ method to just return True -- but because __gt__ must take two arguments, including self, having an unused argument is unavoidable.
As far as I can tell, the only two methods in PYMETHODS where it's still desirable to check for unused arguments would be __init__ and __new__. PYMETHODS is used by other checkers, so changing it doesn't seem like a possibility. My proposed solution would be to just add another condition to 243 so that it reads something like "if node.name in PYMETHODS and node.namenot in ('__init__', '__new__'):". Does this seem like a reasonable fix? Regards, -- Colin Morris Team Tahiti University of Toronto
_______________________________________________ Python-Projects mailing list Python-Projects@lists.logilab.org http://lists.logilab.org/mailman/listinfo/python-projects