Can anyone recomend a good intoduction to C...
pearu at cens.ioc.ee
Sat Mar 10 21:17:14 CET 2001
On Sat, 10 Mar 2001, Alex Martelli wrote:
> "Expected" is correct; it's a social issue, NOT a technical one --
> technically, C++ is a better choice for most Python extensions &c
> on a Linux platform. But, if one wants acceptance, one writes in
> C (e.g., that's what I did for GMPY, because I'd like people to use
> it -- but it would be already out of alpha if had dared use C++, and
> it would be just as fast &c).
> Your opinion is widespread, and self-perpetuating, but it has no
> current technical basis for such tasks as Python extensions on Linux.
I must say that earlier I had also an opinion that no matter what I would
not use C++ for extending Python --- the reasons of my opinion are
now irrelevant after I learned about Boost. Though I had a gap about 2
years of programming in C++, interfacing a C++ library to Python using
Boost was so easy that I caught up with C++ and started to use it on
Boost is an excellent tool, so is gcc. Thanks to the authors of these
But I must say that there is also a dark side in using C++. The
C++ compiler (gcc 2.95.2, in particular) takes more memory (>100MB) than
in my computer when compiling a (still incomplete) Python interface
to the GiNaC C++ library. And this interface has only approx. 300 lines of
code that uses mostly Boost constructs. I don't yet know if I am able to
compile this extension module on my laptop when it will be complete...
In conclusion, extending Python with C++ libraries in connection with
Boost works very fine on Linux **if** you have plenty of memory available
in your computer for compilation. At least, that's my experience.
More information about the Python-list