You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unused variables in list comprehension not reported #593
I agree this particular example should probably produce an error, but pyflakes is a bit timid about assignments in unpackings
for example, should this produce a warning (pyflakes currently assumes any sort of unpacking can introduce variables that don't need to be referenced)?
Aren't unused names expected to be prefixed with _? If not, maybe pyflakes can detect missing f-prefixes in another way?
This kind of errors is not easy to notice otherwise: the types check with any issue; the {x} syntax inside normal strings is also special (for .format) so it's highlighted anyway.
(of course this is a silly example that could be inlined, but it is still a case that comes up). this would introduce a high-false-positive rule which isn't really appropriate for pyflakes and is better left to a flake8 plugin or pylint
Activity
asottile commentedon Nov 17, 2020
I agree this particular example should probably produce an error, but pyflakes is a bit timid about assignments in unpackings
for example, should this produce a warning (pyflakes currently assumes any sort of unpacking can introduce variables that don't need to be referenced)?
lilydjwg commentedon Nov 18, 2020
Aren't unused names expected to be prefixed with
_? If not, maybe pyflakes can detect missingf-prefixes in another way?This kind of errors is not easy to notice otherwise: the types check with any issue; the
{x}syntax inside normal strings is also special (for.format) so it's highlighted anyway.asottile commentedon Nov 26, 2020
that's not something that's errorable either
consider this valid snippet:
(of course this is a silly example that could be inlined, but it is still a case that comes up). this would introduce a high-false-positive rule which isn't really appropriate for pyflakes and is better left to a flake8 plugin or pylint