Skip to content

no-unused-value-marker

Do not use standalone assignments to _ to discard values.

Why

A standalone _ = value assignment adds a binding without clarifying intent. A side-effecting call can be invoked directly, while an unused parameter should be addressed at its declaration.

Fix

Invoke calls directly instead of assigning their result to _. Remove or rename locally owned unused values; when an external interface requires the exact unused parameter, put a narrow reasoned linter suppression on its declaration.

Examples

Before — flagged Invoke a call directly when its result is intentionally unused
app/adapter.py
_ = refresh_cache()
After — preferred Run the call without creating a discard binding
app/adapter.py
refresh_cache()
Before — flagged Do not manufacture a use for interface parameters
app/adapter.py
def render(root: Path, manifest: Path) -> str:
_ = root, manifest
return "ready"
After — preferred Keep a conventional placeholder inside unpacking
app/adapter.py
name, _ = load_pair()