What's your first choice if you have to write a C module for python?

Uwe Schmitt rocksportrocker at googlemail.com
Tue Aug 26 16:18:12 CEST 2008

On 26 Aug., 14:19, 一首诗 <newpt... at gmail.com> wrote:
> Hi all,
> I read this interesting post comparing Boost.Python with Pyd:
> http://pyd.dsource.org/vsboost.html
> What's your opinion about it?
> What's your first choice when you have write a C/C++ module for Python?

I prefer ctypes or f2py. The latter works with C-code too:
Look at http://www.procoders.net/?p=189
f2py is nice if you have to process numerical data, ctypes is
more general for interfacing shared libs and is contained
in Python2.5s standard lib.

Both solutions are more lightweight than Boost which I used some
years ago, but found to complex when building extensions
on different platforms.

Normally I implement basic functionality in a DLL/shared lib
which is wrapped by a Python class to provide pythonic look
and feel.

Greetings, Uwe

More information about the Python-list mailing list