Converting Python app to C++ completely

Peter Hansen peter at engcorp.com
Mon Sep 16 21:51:02 EDT 2002


Roy Smith wrote:
> Joe Knapka  <jknapka at earthlink.nospam> wrote:
> 
>>You might try rewriting it in Python, using lists of characters
>>instead of strings for the stuff that's causing performance
>>trouble. Given str, lst = list(str), then do all the processing
>>(in place) on lst, and ''.join(lst) to turn it back into a string.
> 
> 
> An interesting idea, I'll try it!
> 
> The only problem is, I really had two reasons for converting it
> in the first place.  One was to improve performance, the other was to
> learn C++.  If I solve the first problem in Python, I won't solve the
> second problem at all :-(

Hmmm... if instead you choose to wait until you actually *need* C++
to solve a problem that Python can't handle, you just might find that
you don't ever need to learn C++.  Then the second one is actually
not a problem at all! :-)

This thought courtesy of XP's philosophy of avoiding unnecessary
work, which is acronymized as YAGNI (You Aren't Going to Need It).

-Peter




More information about the Python-list mailing list