flake8 should check for unused multiple assignments
Hi, flake8 2.3.0 warns me when a variable is never actually used, e.g.: a = 1 It doesn't seem to check for unused multiple assigments, e.g.: obj, created = RefutationResponse.objects.update_or_create(...) -- Nik Nyby Programmer Columbia Center for New Media Teaching and Learning nnyby@columbia.edu | (212) 854-7076
On Fri, Mar 6, 2015 at 11:21 AM, Nik Nyby <njn2118@columbia.edu> wrote:
Hi, flake8 2.3.0 warns me when a variable is never actually used, e.g.: a = 1
It doesn't seem to check for unused multiple assigments, e.g.: obj, created = RefutationResponse.objects.update_or_create(...)
-- Nik Nyby Programmer Columbia Center for New Media Teaching and Learning nnyby@columbia.edu | (212) 854-7076
I don't see the same thing Nik. With the following file saved as foo.py: def foo(): a = 1 def bar(): b, c = 2, 3 I get these results: $ flake8 foo.py foo.py:2:5: F841 local variable 'a' is assigned to but never used a = 1 ^ foo.py:6:5: F841 local variable 'b' is assigned to but never used b, c = 2, 3 ^ foo.py:6:8: F841 local variable 'c' is assigned to but never used b, c = 2, 3 ^ $ flake8 --version 2.3.0 (pep8: 1.6.2, pyflakes: 0.8.1, mccabe: 0.3) CPython 2.7.9 on Darwin If instead `a = 1` is a global definition, flake8 (actually pyflakes) chooses not to report it as it could be a constant defined to be exported as part of that module's API. Cheers, Ian
participants (2)
-
Ian Cordasco
-
Nik Nyby