extending the builtin array class from C

J

Joachim Dahl

I would like to inherit the builtin array class and write som extension
methods in C. Other people have suggested that I use numarray for that,
but all I want is a simple continuous C array of doubles, and a way to
access the array directly from some C extension methods.

I thought it would be possible to change the "xxsubtype.c" to accomodate
my needs, but when it comes to actually defining the "array" class I am
a bit lost. There are no header files, so how do I define the "array type?

The init method for the spamdict type of xxsubtype.c module looks
something like:

static int spamdict_init(spamdictobject *self, PyObject *args, PyObject
*kwds)
{
if (PyDict_Type.tp_init((PyObject *)self, args, kwds) < 0)
return -1;
self->state = 0;
return 0;
}

How would I replace the PyDict_Type with an array type? Or is it not
possible to extend all builtin classes from C?

Thanks,
Joachim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top