Adding more warnings

  • Thread starter Thomas Dybdahl Ahle
  • Start date
T

Thomas Dybdahl Ahle

I tend to make a lot of mistakes of misspelled variable names.

Is it possible to make python warn me about those at "compile time"?

Very few times I use dynamic variable initialization. I can live with
getting a warning for those as well.
 
B

Ben Finney

Thomas Dybdahl Ahle said:
I tend to make a lot of mistakes of misspelled variable names.

You would greatly benefit from using tools like 'pyflakes', 'pylint',
and a unit test suite for your code. They're very good for finding
such simple bugs in your code.
Is it possible to make python warn me about those at "compile time"?

The names are resolved at run time, so the compiler has insufficient
information to say whether a name is used incorrectly.
 
F

Frithiof Andreas Jensen

Is it possible to make python warn me about those at "compile time"?

No. The compiler only "knows" about it once the broken code is run. I use
the standard module "unittest" to run through every single bit of Python
code I write.

Maybe silly, but ... I think it saves me time in the end and forces me to
think more about my interfaces because one of the early symptoms of stupid
design is that the test code is a real pain to write. At least Python
applications tend to be compact compared with C++/Java.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top