Basic extension questions.

Joakim Ziegler joakim at login1.styx.net
Mon Dec 27 08:45:28 EST 1999


We develop a C utility library called Flux 
( http://projects.simplemente.net/flux/ , used in, amongst other things, the
Conglomerate document system, http://www.conglomerate.org/ ).

Recently, we've been looking at making Python wrappers for Flux, which would
allow us to embed Python and use it as a standard way of extending
applications like Conglomerate. Python seems perfectly suited for this use.

However, with my decent understanding of both Python and C, there are a few
concepts I'm not sure I've picked up. Specifically, it has to do with how to
define new objects in Python using C.

Flux is buitl around a few core data structures which are used for
everything, the main one being the token tree, reminiscent of a Lisp list.
Now, the Python/C API reference manual seems to be unfinished on the exact
spot I need, chapter 9, Defining new object types. I need to wrap a pointer
to a token tree structure in a python object, and then add some methods to
that object.

So I was wondering if there are any short tutorials or recommended simple
examples out there of how to define a new Python object type using C. What
I'd like is an example of how to create an object with a few methods, which
are also written in C. Does this exist somewhere?

-- 
Joakim Ziegler - styx research director - joakim at styx.net
FIX sysop - FIXmud admin - FIDEL & Conglomerate developer



More information about the Python-list mailing list