Hacker News new | ask | show | jobs
by shadowgovt 1379 days ago
It's not about the why, it's about the fact that because it's possible, the language has to allow for it.

Unless I'm mistaken (and please correct me if I am), no Python linter can address the fact that

`y = myVoriable + 3`

... is valid Python code because there's no way to know a-priori that `myVoriable` isn't a valid global variable, even though human inspection makes it obvious that it's a typo on `myVariable`. For that reason, there's a practical limit on how much static error checking Python allows as per the design of the language.

Has this been changed in the past decade? If so, I should give this language another chance.

1 comments

No, pyflakes will catch that and always would to my knowledge. It did have a bug or three where it would miss an occasional issue but they were bugs (not impossible to detect) and fixed years ago.

The error message is slightly obtuse, says something like "variable only used once." But is clear after inspection the first time.