typo.py - Warn of typographical errors in Python scripts
Arild Hansen
arildh at stud.cs.uit.no
Mon Jul 9 14:08:00 EDT 2001
Hey,
This tool was pretty nifty. I just tested it on some of my code and it
seems to do a nice job. I'll try it out on future work. However, I did
notice that it searched for .py files in the current directory so trying
to run it recursively (for example typo.py MyFiles/myfile.py) does not
work. Although I can change this myself, it could be a nice "upgrade"
feature!
A Hansen
On Mon, 9 Jul 2001, Alan Klietz wrote:
> One of the most common annoyances with using Python is that it does
> not report typographical errors in variable names at compile time.
>
> For example,
>
> def compute_area(width, height):
> area = width * hieght # oops
>
> Another example is a typo in an attribute for a class,
>
> class Square:
> def __init__(self, width, height):
> self.width = width
> self.hieght = height # oops
>
> def compute_area(self):
> return self.width * self.height
>
> typo.py will catch these errors and report them:
>
> hieght might be used before set at line 2
> self.height might be undefined at line 7
>
> You can download typo.py from http://utools.com/typo.htm
>
> Alan Klietz
> Algin Technology
> alank at algintech.NOSPAM.com
>
>
>
>
More information about the Python-list
mailing list