Efficient python programming...

Dmitri I GOULIAEV dmitri.gouliaev at telkel.net
Fri Jun 7 20:28:51 EDT 2002


Hi, Peter Hansen !

 On Fri, Jun 07, 2002 at 07:20:17PM -0400, Peter Hansen wrote:

> Roman Suzi wrote:
> > 
> > On Fri, 7 Jun 2002, Peter Hansen wrote:
> > > You forgot the even more important first thing for a beginner:
> > > get it correct!  The only good way to do this is to write unit
> > > tests that prove it.  If you don't have tests, you don't have
> > > working code (or how can you prove it?).
> > 
> > To prove that code is correct is very difficult (practically impossible).
> > Unittests are there to prove that you have errors, not the other way
> > around.
> > 
> > Of course, they can increase your confidence in that optimized code is
> > equivalent to what you had before.
> 
> I disagree, if the tests are written first (and run, proving that
> they will fail when the code is wrong or missing).

That's what Roman said. If you have the results of tests for your code and your optiimazed code, you show only that in regard of THIS tests your code remains the same ("increase your confidence in that optimized code is equivalent to what you had before").

> The tests are executable requirement specifications.  Running
> them "proves" (yes, not 100%... nothing could) that the code
> meets the specs.  The specs could be wrong of course, but that
> doesn't mean the code is broken...

... if you can write such tests (I mean the tests covering the specifications). In most case, all you can "prove" is that for this particular tests you obtain this particular results.


Best regards,

-- 
DIG (Dmitri I GOULIAEV)
 
All below this line is added by my e-mail provider.





More information about the Python-list mailing list