---
source: crates/ruff/src/rules/pyflakes/mod.rs
---
F841_1.py:6:5: F841 [*] Local variable `x` is assigned to but never used
  |
6 | def f():
7 |     x, y = 1, 2  # this triggers F841 as it's just a simple assignment where unpacking isn't needed
  |     ^ F841
  |
  = help: Remove assignment to unused variable `x`

F841_1.py:6:8: F841 [*] Local variable `y` is assigned to but never used
  |
6 | def f():
7 |     x, y = 1, 2  # this triggers F841 as it's just a simple assignment where unpacking isn't needed
  |        ^ F841
  |
  = help: Remove assignment to unused variable `y`

F841_1.py:16:14: F841 [*] Local variable `coords` is assigned to but never used
   |
16 | def f():
17 |     (x, y) = coords = 1, 2  # this triggers F841 on coords
   |              ^^^^^^ F841
   |
   = help: Remove assignment to unused variable `coords`

ℹ Suggested fix
13 13 | 
14 14 | 
15 15 | def f():
16    |-    (x, y) = coords = 1, 2  # this triggers F841 on coords
   16 |+    (x, y) = 1, 2  # this triggers F841 on coords
17 17 | 
18 18 | 
19 19 | def f():

F841_1.py:20:5: F841 [*] Local variable `coords` is assigned to but never used
   |
20 | def f():
21 |     coords = (x, y) = 1, 2  # this triggers F841 on coords
   |     ^^^^^^ F841
   |
   = help: Remove assignment to unused variable `coords`

ℹ Suggested fix
17 17 | 
18 18 | 
19 19 | def f():
20    |-    coords = (x, y) = 1, 2  # this triggers F841 on coords
   20 |+    (x, y) = 1, 2  # this triggers F841 on coords
21 21 | 
22 22 | 
23 23 | def f():

F841_1.py:24:6: F841 [*] Local variable `a` is assigned to but never used
   |
24 | def f():
25 |     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
   |      ^ F841
   |
   = help: Remove assignment to unused variable `a`

F841_1.py:24:9: F841 [*] Local variable `b` is assigned to but never used
   |
24 | def f():
25 |     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
   |         ^ F841
   |
   = help: Remove assignment to unused variable `b`

F841_1.py:24:15: F841 [*] Local variable `x` is assigned to but never used
   |
24 | def f():
25 |     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
   |               ^ F841
   |
   = help: Remove assignment to unused variable `x`

F841_1.py:24:18: F841 [*] Local variable `y` is assigned to but never used
   |
24 | def f():
25 |     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
   |                  ^ F841
   |
   = help: Remove assignment to unused variable `y`


