[Python-projects] pylint: unused local variables and their context
Sylvain Thénault
sylvain.thenault at logilab.fr
Mon Dec 4 19:19:10 CET 2006
On Monday 04 December à 18:25, Maarten ter Huurne wrote:
>
> 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.
thanks
> > > 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?
yes but I thought we were not talking about the same thing here (eg
unused local variable).
--
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Python et calcul scientifique: http://www.logilab.fr/science
More information about the Python-Projects
mailing list