[Python-projects] pylint: unused local variables and their context

Maarten ter Huurne maarten.ter.huurne at philips.com
Mon Dec 4 18:25:43 CET 2006


syt at logilab.fr wrote on 2006-12-04 04:51:22 PM:

> On Thursday 30 November à 20:16, Maarten ter Huurne wrote:
> > However, I actually prefer the naming convention as a solution, 
> since it makes
> > the fact that a variable is unused explicit. Just disabling the 
> messages will
> > save you some false positives, but can introduce false negatives.
> > 
> > In our project we just accepted that we have to make some 
> modifications in our
> > code to please PyLint:
> > - stick to more naming conventions (unused variables ending in 
underscores,
> > mix-in class names ending in "Mixin")
> > - making all abstract methods explicit (rather than just not 
> defining them in
> > the superclass)
> > - for messages which are useful in general, but not in a specific 
> case: add "#
> > pylint: disable-msg=X0123" comments
> 
> that's the expected usage. You don't mind if I cut and paste this into
> pylint's documentation ?

No problem, please use it.
 
> > To return to the original question: once you decide that you're 
> going to write
> > code with PyLint in mind, adopting a naming convention works better 
than
> > disabling a separated message. I can imagine though that if you start 
using
> > PyLint on a large existing code base, disabling a separated 
> message gives you a
> > way to reduce false positives a lot instantly, instead of having to 
refactor
> > over the course of months.
> 
> I agree, however it's not worth enough for me to implement it...

In the original message, Daniel Drake included a diff ("fromwild.patch") 
which implements a separate warning for wildcard imports, did you see that 
one?

Bye,
                Maarten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.logilab.org/pipermail/python-projects/attachments/20061204/c4296739/attachment.htm 


More information about the Python-Projects mailing list