On Tue, 25 Jan 2011 15:17:55 +0000, James Lingard wrote:
> On Mon, Jan 24, 2011 at 6:14 PM, Sylvain Thénault <
> [email protected]> wrote:
> 
> > On 24 janvier 14:57, James Lingard wrote:
> > > I would like the ability to disable the W0612 warning for variables
> > created
> > > as the result of a sequence unpacking operation.  For example, after:
> > >
> > >   ( a, b, c, d, e ) = mytuple
> > >
> > > pylint will currently complain about all the unused variables.  Although
> > I
> > > could rename the unused variables to something like _b to indicate
> > they're
> > > supposed to be unused, I'd rather just ignore all W0612 warnings in this
> > > case.
> >
> > # pylint: disable=W0612
> >
> > doesn't do the trick?
> >
> 
> Yes, this works, as do all the other solutions proposed (renaming the
> variables, assigning them to dummy, not using unpacking at all).  However,
> I'd rather not change the code at all.  You could argue that it's better to
> have the variables names there, as documentation for what the other
> components of the tuple are.  And in any case, there's nothing wrong with
> the code as it is, and it's always a shame to have to make significant
> changes to perfectly good code just to accommodate tools such as pylint.

  IMHO your code is not perfectly good, in that, just like the tool,
  someone reading it for the first time won't know wether or not
  it was intended that some variables are unused...

> If we were starting out from scratch, maybe we'd follow one of these
> patterns to avoid the warnings.  But I have a huge codebase in which we're
> trying to enable pylint.  Most of the W0612 warnings are due to sequence
> unpacking, and it's a waste of time to fix them all, at least while there
> are lots of more important warnings to fix.

  I'd argue that it's not very long either...
  But well, you'll say that there are a lot of them...

> I'd like to be able to suppress the sequence-unpacking related W0612
> warnings, so that we can enable and fix all the other W0612 warnings, which
> are far more likely to indicate bugs.
> 
> As I said before, if no-one else is known to be working on this, then I'll
> try and do so.

  Would it be a track to have a different warning number for that case ?

-- 
  Eric Deplagne

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to