How to detect typos in Python programs

John J. Lee jjl at pobox.com
Sat Jul 26 19:43:59 EDT 2003


Manish Jethani <manish.j at gmx.net> writes:
[...]
> > The proposed typo catcher would probably catch a typo like
> > 
> >         sys.edit (5)    # finger didn't get off home row
> > 
> > but it probably would *NOT* catch
> > 
> >         sys.exit (56)   # wide finger mashed two keys
> 
> 1)  That's in a different class of typos.  Such things can't be
> auto-detected in any language.  It will probably require close
> examination by the human who wrote it in the first place, or
> someone who has been debugging it.

That was, indeed, precisely the point that was being made.  Tests can
catch these, static type analysis can't.


> 2)  No on calls sys.exit() like that.  5, or 56, is probably a
> constant defined somewhere (where such typos are easier to spot).

Yes.  Do you have a point?


John




More information about the Python-list mailing list