How to detect typos in Python programs

John Roth newsgroups at
Sat Jul 26 02:48:40 CEST 2003

Make it a policy that your unit test suite has 100%
statement coverage at all times. Then this
particular thing won't happen.

How do you do this without impacting your
development? Try Test Driven Development.
If you do it *properly*, you'll get close to
100% statement coverage without any extra

John Roth

"Manish Jethani" <manish.j at> wrote in message
news:ZPaUa.6$gZ.133 at
> Hi all,
> Is there a way to detect typos in a Python program, before
> actually having to run it.  Let's say I have a function like this:
>   def server_closed_connection():
>     session.abost()
> Here, abort() is actually misspelt.  The only time my program
> follows this path is when the server disconnects from its
> end--and that's like once in 100 sessions.  So sometimes I
> release the program, people start using it, and then someone
> reports this typo after 4-5 days of the release (though it's
> trivial to fix manually at the user's end, or I can give a patch).
> How can we detect these kinds of errors at development time?
> It's not practical for me to have a test script that can make
> the program go through all (most) the possible code paths.
> -Manish
> -- 
> Manish Jethani (manish.j at
> phone (work) +91-80-51073488

More information about the Python-list mailing list