[Numpy-discussion] Numpy/Cython Google Summer of Code project idea
Thu Mar 6 18:11:55 CST 2008
I'm not a pyrex/Cython expert, but....
Joris De Ridder wrote:
> Pyrex is kind of a dialect, so your extension modules would be nor
> python nor C, but a third language.
> Is this indeed easier to maintain?
yes, because while you can write C extensions in C, you need to use the
quite complex Python/C api, and get all sorts of things like reference
counting, etc right too -- that is hard.
Also, with Cython, you can quite easily mix Python and C in one place,
so you truly only need to put the performance intensive bits in Cython
> When you would like to use legacy C code for an extension, would you
> rewrite it in Cython?
no -- you can call regular old C from Cython, so you can use it to write
> What are Cython's advantages compared to ctypes?
for ctypes, you also avoid the wrapping code, but your C code needs to
be compiled as a library, and can't use python types directly, which is
I think Cython is easier for someone not very experienced in C, and no
harder for someone who is.
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
More information about the Numpy-discussion