typo.py - Warn of typographical errors in Python scripts

Alan Klietz alank@algintech.com
Mon, 9 Jul 2001 11:55:06 -0500


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@algintech.NOSPAM.com