pyflakes icon indicating copy to clipboard operation
pyflakes copied to clipboard

Make F841 ignore setting to `__` variable and setting to variables prefixed with `_`

Open Jackenmen opened this issue 3 years ago • 1 comments

While _ is commonly used to name a "throw-away variable", it doesn't work for codebases that use gettext and assign it to a variable called _. In such cases, "throw-away variables" can be named __ instead (I think it's common to gettext-based projects, but I don't have much to prove that). Another thing that I've noticed being used among different projects is to have a "throw-away variable" be prefixed with _, e.g. _some_unused_variable. So, I was wondering if it would be possible to support either of these use cases. I know pylint does support these, amongst a few other patterns and it definitely seems useful to have at least some other way to mark a variable as "throw-away", especially that it is common for i18n projects to use _ for gettext instance.

Jackenmen avatar Mar 06 '21 00:03 Jackenmen

Sorry, this fork is entering retirement! You may wish to check https://github.com/PyCQA/pyflakes

kevinw avatar Mar 07 '21 12:03 kevinw