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
$ ruff --version
ruff 0.5.2
$ ruff check --select PLR1704 test.py
test.py:2:26: PLR1704 Redefining argument with the local name `foo`
|
1 | def func(foo):
2 | for _ in bar(foo for foo in [1]):
| ^^^ PLR1704
3 | pass
|
Found 1 error.
However, aside from the iterable expression in the leftmost for clause, the comprehension is executed in a separate implicitly nested scope. This ensures that names assigned to in the target list don’t “leak” into the enclosing scope.
The text was updated successfully, but these errors were encountered:
This code snippet
triggers PLR1704 with ruff 0.5.2
which is wrong. From the python3 docs:
The text was updated successfully, but these errors were encountered: