[Tutor] Using C in python

Kent Johnson kent37 at tds.net
Wed Mar 25 22:36:40 CET 2009


On Wed, Mar 25, 2009 at 5:13 PM, amit sethi <amit.pureenergy at gmail.com> wrote:
> what are the ways in which i can use C in python programs . I know there is
> SWIG bindings are there any other . Also Could anyone explain how Swig
> bindings work?

There are quite a few options:

SIP, SWIG and ctypes (in the std lib) build wrappers for C libraries.

http://www.scipy.org/Weave lets you include C++ in a Python module.
boost::python wraps C++ libraries.

Pyrex and Cython compile Python-like source code to C extensions.

I haven't used any of these and can't tell you much about them. Google
will get you more info.

Kent


More information about the Tutor mailing list