distutils and ctypes

"Martin v. Löwis" martin at v.loewis.de
Wed Jan 10 01:42:22 EST 2007


Robert Kern schrieb:
> To which I say that doing the type-checking and error handling is much easier in
> Python than using the C API. Add to that the tediousness of the edit-compile-run
> cycle of C and the finickiness of refcounting.

Sure: edit-compile-run is tedious, but in the given case, it is
necessary anyway. Also, refcounting is finicky, but with ctypes,
you often have to use just as finicky memory management APIs.
(such as using specific allocation and deallocation routines,
or having to do memory management at all when in C you would
do stack allocation).

My main concern with ctypes is that you have to duplicate
information from the header files, which is error-prone,
especially when the header files may change (either across
versions or across target systems).

Regards,
Martin



More information about the Python-list mailing list