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.

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 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.

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

Reply via email to