←back to thread

498 points azhenley | 2 comments | | HN request time: 0s | source
1. mr_mitm ◴[] No.45769640[source]
Is there a ruff rule for this?
replies(1): >>45773735 #
2. maleldil ◴[] No.45773735[source]
There are [1] and [2] for function arguments and loop variables, respectively, but nothing for the general case. Note that a type checker will complain if you re-assign with a different type. Pylint also has [3] for redefining variables from an outer scope, but Ruff doesn't implement that yet.

[1] https://docs.astral.sh/ruff/rules/redefined-argument-from-lo...

[2] https://docs.astral.sh/ruff/rules/redefined-loop-name/

[3] https://pylint.pycqa.org/en/latest/user_guide/messages/warni...