On Mon, Jan 24, 2011 at 3:17 PM, Jean-Michel Pichavant <
[email protected]> wrote:

> 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.
>>
>> Is this feature available in the latest version of pylint?  Has anyone
>> else requested this feature?  If not, then I may work on implementing it.
>>
>> Thanks,
>> James.
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Python-Projects mailing list
>> [email protected]
>> http://lists.logilab.org/mailman/listinfo/python-projects
>>
> Actually, people do things slightly diferently:
>
> a, _, c, _, _ = mytuple
>

I could have sworn I'd tried this and it didn't work (I thought Python
complained about multiple assignment to the same variable), but I just tried
it on Python 2.6.2, and it works fine.  Maybe it changed since Python 2.5,
or maybe I have a bad memory :)

James.




>
> another alternative:
>
> a = mytuple[0]
> c = mytuple[2]
>
> Anything suiting your needs ?
>
> JM
>
>
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to