separate option for unused destructuring-bind variables
Brought to you by:
fabioz
It's fairly common, especially in a loop context, to do
> for root, dirs, files in os.walk(path):
and use only 'root' and 'files'.
I would like an option to ignore unused variables in this context if at least one of the variables is used; i.e. if I were to use "root" and "files" in that expression, I should not get a warning about "dirs".
Actually, currently pydev won't report unused variables that start with '_', 'unused' or 'dummy'. You can configure that at window > preferences > pyde > editor > code analysis > 'Don't report unused variable if name starts with'.
So, in your case, it'd be a matter of naming it '_files' or 'dummyRoot'.
I know about that feature, and it's a good one (I'll be doing that in any new code that I write) but I work on large codebases with strict code-review policies, and if a file has a bunch of instances of this error-that-isn't-really-an-error in it, I currently have 2 choices:
* turn off warnings for unused variables entirely (I don't like that, because *most* of the time the warning is helpful)
* rename a whole ton of variables unrelated to the change that I'm trying to make, and argue with the code-reviewer about the change being too big
* manually step through every instance of the error to make sure I'm not introducing any new problems
I would really like it if pydev didn't make me choose one of these bad options, and instead I could set a preference that asked not to warn about this particular variance of the error.
Alternately, pyflakes <http://divmod.org/trac/wiki/DivmodPyflakes> already treats destructuring-bind this way, so if I could just tell pydev to use pyflakes rather than its own stuff for warnings and errors, I'd be happy.
Leaving open for consideration...
Thanks for your consideration :).