Extend Python

Filip Dreger fdreger at amiga.pl
Thu Sep 1 19:09:55 CEST 2005


> My Question:
> Swig offers some great features but is to basic for us. Is there
> another program that creates more readble code that can be easily
> edited? How much work is it to write our own wrappers?

Not too much, and practicaly not at all if you want to wrap procedures 
(not objects or types):
 - marshaslling an argument list from Python to C and from C to Python 
takes exactly 1 line of code,
 - handling errors takes 2 lines of code (unless you want to do 
something fancy with them; I mean just catching an exception and 
getting the error message).
 - entry in the PyMethodDef is one simple line
Bottomline: you need 5 additional lines of C code per procedure to 
make it usable from Python.
Unless you have hundreds of procedures, there is no point in using 
special tools to do that. Especially if you need full control over the 
results.

regards,
Filip Dreger
-- 
Akademia Linuksa - http://www.akademia.linuksa.pl 





More information about the Python-list mailing list