writing a C function to manipulate python lists

Michael Vanier mvanier at endor.bbb.caltech.edu
Thu Mar 1 08:59:36 CET 2001


I've been programming in python for many years but have never had to solve
this particular problem.  I would like to write a short C function that will
be part of a python-callable module.  The function will receive two python
lists as arguments.  Currently I do this in python, but my code uses this
function very heavily and it's the major speed bottleneck in the code.  The
hope is that the C function will be much faster than iterating through the
lists in python (which may not be true, but I'd like to see for myself).  

If anyone has some code lying around that does something like this, could
they pass it on to me?  I haven't seen this kind of thing in the official
python docs.  I'd also prefer to use the C representation of python lists
directly for speed, because using the C API would probably slow things down


Mike Vanier	mvanier at bbb.caltech.edu
Department of Computation and Neural Systems, Caltech 216-76

More information about the Python-list mailing list