Converting Python app to C++ completely

Alan James Salmoni salmonia.nospam.please at cardiff.ac.uk
Thu Aug 29 13:37:35 EDT 2002


Hi all,

I am *very* sorry is this has been answered before (I'm sure it must 
have at some point), but trawling Google Groups hasn't shown anything 
completely relevant to my question.

I have written an application (a package for statistical analysis - 
SalStat) using Python and wxPython, not just because I wanted to, but 
also to learn the language. I found both Python & wxPython to be superb 
for the task.

Now, what I want to do is write the thing in C++. The reason? heh, 
because I want to ;) Well, actually I want to learn C++ too, and I would 
like to have the performance of a compiled program for larger data sets 
(just for fun and comparison more than anything).

I know very little about C++, but have a few questions about converting 
from Python code. I am asking here because Pythonistas are more likely 
to know C++ than vice versa (and CLP is one of the friendliest groups 
around - creep, creep).

1) How easy is it to convert existing Python code to C++? I read that 
each line of C++ code is roughly equivilent to 5-8 lines of C++ code, 
but is the conversion a simple task or is it troublesome?

2) Are there any pitfalls to beware of - I understand that dealing with 
memory and pointers might be a problem, but like I said earlier, I just 
don't really know?

3) Does C++ have equivilent functional constructs like reduce and map? 
These helped to make my code much cleaner, tighter and faster, and I 
would miss them dearly.

4) wxWindows - From what I can understand from the wxWindows 
documentation, the conversion should be relatively straightforward, but 
I would appreciate a more experienced opinion.

5) Is there a free C++ compiler for Mac OS8/9? I am going to use GCC for 
every other platform (the Python version is currently multi-platform - 
even OSX, but not OS8 or 9 sadly).

btw - the code I am writing doesn't rely upon any platform specific 
stuff at all and is quite portable in Python - I will be aiming for the 
same thing in Python and assume it will be possible.

Appreciated,

Alan.




More information about the Python-list mailing list