469,343 Members | 5,484 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

"static" checking

I'm wondering what kind of checking I can do on a python program before
running it (besides reading over every line). I hate running a long python
script, only to have it fail at the end because I misspelled a function
name, or made some other silly mistake that a compiler would normally catch.
Then I have to run it all over again to see what happened or come up with
some sort of short test.

I usually do try to isolate the new parts of my code, and run them first
with some dummy data that will run fast. But that is not always possible
because of dependencies, and it would be nice to have some sort of sanity
check up front.

I noticed there is a "check" function in IDLE, and I've tried running it but
it never does anything. Maybe it is not catching the kinds of errors that
are biting me.

thanks,
MB
Jul 18 '05 #1
3 1392
On Thu, 29 Jan 2004 04:37:17 +0000, Moosebumps wrote:
I'm wondering what kind of checking I can do on a python program before
running it (besides reading over every line).


Check in IDLE isn't bad. I'm not sure what it's running. I know that it
runs tabnanny and probably runs pychecker also. Pychecker is quite handy.

Tim Ottinger

Jul 18 '05 #2
Le Thu, 29 Jan 2004 04:37:17 +0000, Moosebumps a écrit*:

Hi,
I'm wondering what kind of checking I can do on a python program before
running it (besides reading over every line). I hate running a long python
script, only to have it fail at the end because I misspelled a function
name, or made some other silly mistake that a compiler would normally catch.
Then I have to run it all over again to see what happened or come up with
some sort of short test.


Have a look at pylint (http://www.logilab.org/projects/pylint)

Cheers,

--
Adrien Di Mascio
LOGILAB, Paris (France).
http://www.logilab.com http://www.logilab.fr http://www.logilab.org
Jul 18 '05 #3
Moosebumps wrote:

I'm wondering what kind of checking I can do on a python program before
running it (besides reading over every line). I hate running a long python
script, only to have it fail at the end because I misspelled a function
name, or made some other silly mistake that a compiler would normally catch.
Then I have to run it all over again to see what happened or come up with
some sort of short test.

I usually do try to isolate the new parts of my code, and run them first
with some dummy data that will run fast. But that is not always possible
because of dependencies, and it would be nice to have some sort of sanity
check up front.


These issues largely go away once you start doing test-driven development.
See, for example, Mark Pilgrim's excellent introduction in his book at
http://www.diveintopython.org/ (see the link under "unit testing"), or
Kent Beck's paper book "Test-Driven Development" (published by Addison Wesley).

With this approach, your code generally won't have those dependencies
(sometimes the approach has to be tried before someone can really believe
that, but it's true) and you find your spelling mistakes, and many other
problems that static checking can't find, in seconds without no more
effort than it takes to run a batch file.

-Peter
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

29 posts views Thread by Alexander Mahr | last post: by
3 posts views Thread by Ajax Chelsea | last post: by
12 posts views Thread by cppaddict | last post: by
3 posts views Thread by ruud.bos | last post: by
9 posts views Thread by Neil Kiser | last post: by
11 posts views Thread by comp.lang.php | last post: by
14 posts views Thread by Jess | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.