[Cython] Measuring "C-ness"?
Robert Bradshaw
robertwb at math.washington.edu
Sun Feb 8 00:09:09 CET 2009
On Feb 7, 2009, at 3:44 AM, Magnus Lie Hetland wrote:
> On Feb 7, 2009, at 09:24 , Greg Ewing wrote:
>
>> Magnus Lie Hetland wrote:
>>> Ideally, though, the search
>>> operations (performed after the structures have been built)
>>> should be
>>> initiated from Python, but then stay in as pure C as possible
>>
>> One way to guarantee that something uses purely C
>> operations is to actually write it in C, as an
>> external piece of code, and call it from Cython.
>
> Absolutely an option. It may even be the most sensible thing to do,
> rather than trying to program in C using Cython :-)
Of course this requires one to keep two files in sync, make "cdef
extern" declarations, and have a more complicated setup.py (i.e. no
using pyximport), and risk gcc as well as Cython errors. I "program C
using Cython" all the time--using the annotate option it is easy to
see when a block of code gets compiled to pure C. But it's a matter
of personal preference.
- Robert
More information about the Cython-dev
mailing list