[Pyrex] Pyrex versus ctypes

David McNab david at rebirthing.co.nz
Fri Jun 11 00:38:52 CEST 2004


Bob Ippolito wrote:
> It takes more time to wrap a C API with ctypes than with Pyrex because 
> you can't leverage anything that the C compiler and preprocessor knows 
> about.

That one does ring my alarm bells somewhat.

Pyrex's hack of allowing #define'd literals to be made available via 
'ctypedef enum' allows the tokens to be used symbolically, where with 
ctypes one has to specify the values as well, which makes ctypes 
wrappers brittle against future api versions.

It's a shame that Pyrex can't preprocess .h files and expose their 
contents into the wrapper module's namespace. There's still a 
brittleness wrt struct definitions.

Cheers
David






More information about the Pyrex mailing list