Should I use "if" or "try" (as a matter of speed)?

Ron Adam rrr at ronadam.com
Sun Jul 10 15:00:26 EDT 2005


Roy Smith wrote:

> Thomas Lotze <thomas at thomas-lotze.de> wrote:
> 
>>Basically, I agree with the "make it run, make it right, make it fast"
>>attitude. However, FWIW, I sometimes can't resist optimizing routines that
>>probably don't strictly need it. Not only does the resulting code run
>>faster, but it is usually also shorter and more readable and expressive.
> 
> 
> Optimize for readability and maintainability first.  Worry about speed 
> later.

Yes, and then...

If it's an application that is to be used on a lot of computers, some of 
them may be fairly old.  It might be worth slowing your computer down 
and then optimizing the parts that need it.

When it's run on faster computers, those optimizations would be a bonus.

Cheers,
Ron




More information about the Python-list mailing list