SWIG vs Pyrex vs Cython -- a quicky question

Jelmer Vernooij jelmer at samba.org
Mon Sep 21 13:20:04 BST 2009


Russel Winder wrote:
> Not an on-topic question I guess, but the audience here is likely
> knowledgable on this topic, so makes a great sample.
>
> For calling C functions from Python test code, to unit test the C code,
> is it better to use SWIG or Pyrex or Cython?  ctypes is not a candidate
> I think as this is not connecting to a library, shared object or DLL.
>
> Thanks.
>
> (If people want to email me privately rather than the list, I will
> collate and publish results received.)
Plain C before Pyrex/Cython before SWIG.

See
http://jelmer.vernstok.nl/blog/archives/218-bzr-svn-now-with-its-own-Subversion-Python-bindings.html
for some of the reasons why I picked plain C over SWIG. Pyrex/Cython are
also good candidates, especially if you're more familiar with Python
than with C.

Cheers,

Jelmer



More information about the bazaar mailing list