Help me choose a C++ compiler to work with Python

Cy Edmunds cedmunds at spamless.rochester.rr.com
Sun Sep 21 15:25:58 EDT 2003


"rhmd" <rh4170056 at juno.com> wrote in message
news:616fccba.0309210907.1e35b92d at posting.google.com...
> Just found Python and I love it.  What an elegant language!

Yeah, me too. :)

>    I would like to use it for various applications, but the
> mathematical calculations are way too slow (a million sines 8 seconds
> in Python vs. 2 seconds in Excel VBA), so was thinking of learning
> enough C++ to do the number crunching in C++ and integrating the C++
> routines with Python.

This one really has me squirming in my seat. C++ isn't a very good language
for learning just a little bit of. Compared to Python I would say the
learning curve is much steeper. It offers a lot of control over how the
object code is generated but that also makes it dangerous for casual users.
If you do it wrong a lot of bad things can happen, including poor
performance -- although poor performance would perhaps be the best of those
bad things!

I suggest you look at various Python libraries to do whatever numerical
processing you might need to do. They are mostly written in C anyway so
their performance is excellent. For instance, I use SciPy for Fourier
analysis and PIL for image processing, getting good performance on these
numerically intensive tasks without ever leaving the ease and comfort of
good old Python.

My question:
>    My question:
>    Which compiler works best with Python?

I wouldn't choose your C++ compiler for Python compatibility. How good is
the debugger? How is the standards conformance? C++ compilers vary widely in
these and other important criteria.

> I use Windows XP and 98.  Have very little experience with C++.  Am
> doing statistical and other simulations that require billions of
> calculations (taking 1 to 2 hours in Excel VBA).

Take a look at the UVS library under my sig for some C++ code which I have
found useful for statistical simulations.

GCC is free, MS
> C++.Net is affordable at <$100 but supposedly has problems until the
> next version (and I could only use it on my XP machine), older
> versions of MS C++ are no longer for sale.  What's the most robust
> solution?

The .NET compiler has a very good debugger and much better standard
compliance than the old 6.0 compiler, but I haven't used  lot of different
recent vintage C++ compilers.

I would also like to make .dll files that I can plug into
> MS Excel.

I generally use COM objects written in Python to connect to Excel. I am very
pleased with that technique.

http://starship.python.net/crew/mhammond/

>    Sorry for the vagueness of this question, but I'm sure many of you
> have experience with this and any information, opinions, and even
> prejudices about the various compilers are welcome.
>    Thanks.

-- 
Cy
http://home.rochester.rr.com/cyhome/






More information about the Python-list mailing list