Incrementally converting a C app to Python

BJörn Lindqvist bjourne at
Tue May 9 23:57:54 CEST 2006

Hello. At work I'm the sole maintainer and developer of a medium sized
~50k line C application. The lion share of this app was written before
my time so it is pretty hard to read and also contain lots of bugs.
I'm contemplating converting the project to Python because I think
that, in the long run, maintenance will become much easier. And also
because is so much more fun than C.

The app is to big to be rewritten from scratch so I'm thinking of a
way to rewrite it "incrementally." Something like one module, or file,
at a time. Using tools like SWIG, Pyrex or embedding Python in C it
seems like this would be possible. My question is what tools should I
apply and what strategy should I use? Would it be best to use a
top-down approach and rewrite the main files first and work my way
down wrapping the remaining C files using SWIG? Or should I convert
the isolated code files to Python and then embedd it in the C code?
Maybe Pyrex help me with this task? Any insight on this matter is
greatly appreciated. Surely someone has done the exact same thing as
me before.
mvh Björn

More information about the Python-list mailing list