declaration of variables?
exarkun at intarweb.us
Sun Feb 16 22:35:25 CET 2003
On Sun, Feb 16, 2003 at 09:36:00PM +0100, Andr? Jonsson wrote:
> Jp Calderone wrote:
> > I don't understand what this even means. If the error isn't
> > *detectable*, it obviously isn't even an error.
> Hmm, how about this example: if a given function sorts some list, if there
> is an error in there that doesn't cause a run-time error. How is it
> possible to detect this without having to write the whole routine once
> more and compare the results? (which, of course, is an error-prone
For this specific case, by relying on the high-level functionality
provided by Python.
L1 = superSortFunction(testList)
L2 = testList[:]
Perhaps you might transform a list in some much more complex way, though,
for which there is no Python builtin. In this case, one common solution is
to compute the output for a particular group of inputs yourself, or using a
known-correct piece of software, and then compare against this pre-computed
data in your unit tests. Selecting the inputs is important, of course, for
if you miss a particular branch of your algorithm, you will have failed to
test it for correctness.
This all seems pretty far afield, though. I can't think of any time when
a typo in a variable has led to a -subtle- error. Invariably, this kind of
error leads to gross misfunction of part of the program, often resulting in
a cascade of unit test failures that screams out that something has broken.
up 8 days, 2:28, 1 user, load average: 0.17, 0.04, 0.01
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
More information about the Python-list