Terry Reedy, 17.01.2011 22:38:
> A few other details confuse me, but enough for now.

It's helpful to be reminded from time to time that the documentation shows 
the usual "features" of an underfinanced OpenSource project. Part of it was 
inherited from the original Pyrex documentation and suffers from bit rot, 
and some other parts were copied over from the Wiki or from talk notes and 
continue to be badly integrated with the rest.

Maybe we should call out a docathon on the cython-users list to see if we 
can't get some of our happy users to give something back by fixing up the 
obvious problems in the documentation. Some have done so in the past 
already, even without being asked.


> My main interest at the
> moment is whether Cython is a viable third method (versus swig and ctypes)
> for wrapping C library code for access from Python. It seems to sit in
> between somewhat.

Regarding a comparison with SWIG, you might find this interesting:

http://www.mail-archive.com/[email protected]/msg01354.html

I do not consider SWIG a real alternative, except when it can play its 
single joker, i.e. you want to generate and maintain a substantial set of 
identical wrappers for different languages. You might want to do that if 
you are the author of the library you wrap, but it's a lot less likely that 
you want to do it if you are a user of the library.

I consider ctypes a viable alternative with two main advantages: a) it's 
part of CPython, which b) makes it plain Python to work with. Even PyPy 
supports it (IIRC), and Jython has at least been thinking about it for a while.

Cython will always depend on CPython (*), on a C compiler, and on the 
ability to install and use binary extension modules. However, once you 
cross that barrier, the main advantages of Cython strike immediately: it 
has a much more natural way to deal with external C code than ctypes 
(assuming the same level of C knowledge that you also need for ctypes), and 
it's substantially faster.

Stefan


(*) or at least on its C-API - there's also work being done on a port to 
IronPython
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to