[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Adding more warnings

lobais@gmail.com

2/19/2008 10:08:00 PM

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.

--
Best Regards,
Med Venlig Hilsen,
Thomas

2 Answers

Ben Finney

2/20/2008 9:09:00 AM

0

Thomas Dybdahl Ahle <lobais@gmail.com> writes:

> 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.

--
\ "Program testing can be a very effective way to show the |
`\ presence of bugs, but is hopelessly inadequate for showing |
_o__) their absence." -- Edsger Dijkstra |
Ben Finney

Frithiof Andreas Jensen

2/22/2008 12:57:00 PM

0


"Thomas Dybdahl Ahle" <lobais@gmail.com> skrev i en meddelelse
news:mailman.1001.1203497818.9267.python-list@python.org...

> 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.