On 09/10/2022 10.49, Avi Gross wrote:
My guess is that finding 100 errors might turn out to be misleading. If you
fix just the first, many others would go away. If you spell a variable name
wrong when declaring it, a dozen uses of the right name may cause errors.
Should you fix the first or change all later ones?

Just to this, these are semantic errors, not syntax errors. Linters do an ok job of spotting these. Antoon is after _syntax errors_.

On 10Oct2022 08:21, Michael F. Stemper <michael.stem...@gmail.com> wrote:
How does one declare a variable in python? Sometimes it'd be nice to
be able to have declarations and any undeclared variable be flagged.

Linters do pretty well at this. They can trace names and their use compared to their first definition/assignment (often - there are of course some constructs which are correct but unclear to a static analysis - certainly one of my linters occasionally says "possible undefine use" to me because there may be a path to use before set). This is particularly handy for typos, which often make for "use before set" or "set and not used".

I'd love it if there was something similar that I could do in python.

Have you used any lint programmes? My "lint" script runs pyflakes and pylint.

Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to