Efficient python programming...

Roman Suzi rnd at onego.ru
Fri Jun 7 08:25:17 EDT 2002


On Fri, 7 Jun 2002, Peter Hansen wrote:

> Eddie Corns wrote:
> > 
> > A friend is fond of quoting this to me:
> > 
> >   Rules of Optimization:
> >     Rule 1: Don't do it.
> >     Rule 2 (for experts only): Don't do it yet.
> >   -- M.A. Jackson
> > 
> > I wasn't going to bother contributing since others have said the same thing
> > but the more people say the more you'll believe it :)
> > 
> > Especially for a beginner the important thing is to get clear and obvious
> > code.  Later, IF IT ISN'T FAST ENOUGH, then you think about ways to speed it
> > up.
> 
> 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.

> -Peter

Sincerely yours, Roman A.Suzi
-- 
 - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
 






More information about the Python-list mailing list