[capi-sig] How to manipulate C table as python list ?

Jack Jansen Jack.Jansen at cwi.nl
Sun Jan 18 23:24:43 CET 2009


On  18-Jan-2009, at 01:06 , Marc wrote:
> I would like to use a C program which manipulates table
> as a python module acting on a list.

Marc,
if you're doing this for speed you may want to look at Numeric Python <http://numpy.scipy.org/ 
 >. They have a set of array-like objects that are (a) pretty standard  
from a Python point of view and (b) pretty efficient from a C point of  
view. As soon as you're doing serious number crunching the NumPy  
arrays will run circles around any code that converts between Python  
lists and C arrays, because there isn't any conversion done. NumPy  
arrays are used by all sorts of other libraries that have large  
numeric datasets (think audio processing, etc).

Also, for the algorithms you've sketched in your example you don't  
even have to write any code in C: it's all there in NumPy already.

--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma  
Goldman





More information about the capi-sig mailing list