Skip to content

Comment on Want to call C from Python? Use Dparent

Comments

ctypes allows you to trivially mistype C objects, send the wrong types and number of arguments to C functions, etc. Cffi just imports C headers and gives you more or less what TFA illustrates (without D).

ctypes allows you to trivially mistype C objects

I mean, so does C. Pretty sure that's a "feature". ;)

But yeah, fair point; it's definitely nice when an FFI wrapper is able to actually read the header files and figure out function/type signatures.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.