Martin v. Löwis wrote: > Robert Kern schrieb: >>> Not sure it's stupid, but I wonder why you want to use ctypes. What's >>> wrong with extension modules? >> What's wrong with ctypes? They're both valid, useful approaches to connect >> to C >> libraries. > > See the original posting. Distutils doesn't support building arbitrary > shared libraries, but does support building extension modules. > > Furthermore, extension modules are more type-safe and more expressive > than loading shared libraries through ctypes. IMO, you may consider > using ctypes as a last resort - if you have the chance for a > well-engineered solution, write a compiled wrapper.
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. There's nothing *wrong* with either approach. They're just different and have different strengths and weaknesses. Some of those weaknesses are remediable (say by using the bdist_shlib command that the OOF2 project implemented) and some aren't. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list