What's your first choice if you have to write a C module for python?
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:
> 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
More information about the Python-list