Skip to content

unused-unpacked-variable

Pythonsuspiciousno fixdefault: offpython/ruff

Reports a name of a tuple target in a function that the function never reads. A name that starts with _ and a function that calls locals() are left alone.

a, b = f() where b is not used binds a value for nothing, and the reader looks for where it is used. The unused value is also a hint that the function returns more than the caller needs.

To fix, name it _, or take only the items that are used.

Reported
def f():
a, b = g()
return a
class A:
...
python:
lint:
rules:
unused-unpacked-variable: warn # off (default), warn, error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line unused-unpacked-variable in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ruff RUF059 full