←back to thread

498 points azhenley | 2 comments | | HN request time: 0.435s | source
1. considerdevs ◴[] No.45770329[source]
This is the kind of wisdom that comes after hours of debugging and discovering the bug was your own variable reuse.

Wouldn't this be an easy task for SCA tool e.g. Pylint? It has atleast warning against variable redefinition: https://pylint.pycqa.org/en/latest/user_guide/messages/refac...

replies(1): >>45773545 #
2. maleldil ◴[] No.45773545[source]
This is only for redefinitions that change the type. If you re-assign with the same type, there's no warning. However, pylint does issue warnings for other interesting cases, such as redefining function arguments and variables from an outer scope.