Spelling mistakes!

Antoon Pardon apardon at forel.vub.ac.be
Mon Jan 9 06:21:10 EST 2006


Op 2006-01-06, Terry Hancock schreef <hancock at anansispaceworks.com>:
> On 6 Jan 2006 07:30:41 -0800
> "KraftDiner" <bobrien18 at yahoo.com> wrote:
>> I've spent hours trying to find a bug that was a simple
>> spelling mistake.
>
> You're not the first. ;-)
>
>> in an init method I declare a variable  self.someLongName
>> 
>> later in a different method of the class I use
>> self.sumLongName
>> Now I really meant self.someLongName.
>> In fact I don't want a variable called sumLongName.
>> Frankly how are you ever to know if this type of error is
>> occuring?
>
> Both "unit tests" and "interfaces" are useful for catching
> simple errors like this one.  There is a 'unittest' module
> in the Python standard library, and 'interface' modules are
> available from the Zope 3 project and PyProtocols, both are
> good.

I don't think unit tests are that helpfull in this case.
Unit tests help you in finding out there is a bug, they
don't help that much in tracking down a bug.

I for some reason a person is reading over the difference
between sumLongName and someLongName and doesn't notice
the different spelling in his source a unit test won't
be of much help.

-- 
Antoon Pardon



More information about the Python-list mailing list