A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/342153.html below:

Extend Python

Extend PythonJorgen Grahn jgrahn-nntq at algonet.se
Sat Sep 3 12:49:24 EDT 2005
On Thu, 1 Sep 2005 19:09:55 +0200, Filip Dreger <fdreger at amiga.pl> wrote:
>> 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.

My experience too. At least if you are a C programmer.

If it gets hard, it's because the things you wrap do something funky: take
complex memory structures as arguments, have odd resource management, etc.
A tool cannot help you with that anyway.

/Jorgen

-- 
  // Jorgen Grahn <jgrahn@       Ph'nglui mglw'nafh Cthulhu
\X/                algonet.se>   R'lyeh wgah'nagl fhtagn!

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4