Distributed App - C++ with Python for Portability?

Carl Banks pavlovevidence at gmail.com
Mon Mar 10 21:59:21 CET 2008


On Mar 9, 7:41 pm, Roopan <elampoora... at gmail.com> wrote:
> Hello!
>
> I am looking at developing an enterprise-grade distributed data
> sharing application - key requirements are productivity and platform
> portability.
>
> Will it be sensible to use C++ for performance-critical sections and
> Python for all the glue logic.
> Pls comment from your *experiences* how Python scales to large
> projects( > 200KLOC).
> I assume the C++/Python binding is fairly painless.


200K with C++ lines of code or Python lines of code?  :)

I can comment on 50K lines of Python code, and considering how I write
Python and how most people write C++ that might be about the same as a
200K C++ program.  But it's not an enterprise app, so take it as you
will.

I've had no real issues.  95% of the program in Python; with only a
couple sections written in C, and a few wrappers for C/C++ libraries.
My wrappers are as thin as I can reasonably make them; where needed I
make the interface prettier with a higher-level Python wrapper.

I'm writing regular extensions, not using ctypes, Cython, SWIG,
Boost::python or anything like that.  I am using ctypes for some
related tools and it's pretty nice.  The others I can't comment on,
except to say I sometimes didn't have enough memory to compile third-
party SWIG extensions.

I develop it on Linux, but every few months or so I'd copy it to
Windows and update it so that it works on both.  This was a minor
hastle, which is not so bad considering it hadn't seen Windows for
months.  (In fairness, I am using the same compiler, gcc, on both.
Getting mingw gcc to work on Windows was a major hassle, but a one-
time thing.)


Python's a lot better productivity-wise, and it's worked well as a
cross-platform solution for me.  The interfacing is the main
drawback.  It's always a bit of effort to interface things, and to get
it working on multiple platforms, but I thought it was worth it.


Carl Banks



More information about the Python-list mailing list