* Another approach is to modify your pylintrc to indicate that certain variable 
names should always be considered "good"
* For exampe, if you often use "i", "j", or "k" as a loop index then add

        good-names="i,j,k"

des.

On 19/07/2010, at 07:32 , [email protected] wrote:

> 
>    chris>  How make PyLint just ignore unused variables of for loops?
>    chris>  e.g. "i" in "for i in range(10)" ?
> 
>    chris> I want PyLint to warn me of unused variables.  The problem is
>    chris> that for loops are the one exception where you often have
>    chris> legitimate "unused" variables.
> 
> Just like with unused formal parameter names I think you can preface them
> with an underscore, e.g.:
> 
>    for _i in range(10):
>        pass
> 
> Aside from keeping PyLint happy that should be familiar usage for other
> people reading your code.
> 
> -- 
> Skip Montanaro - [email protected] - http://www.smontanaro.net/
> _______________________________________________
> Python-Projects mailing list
> [email protected]
> http://lists.logilab.org/mailman/listinfo/python-projects

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

Reply via email to