[Numpy-discussion] Pointers to arrays in C
Tue Jun 3 11:21:56 CDT 2008
Hi, I read a file with array data (one per line), and send the arrays to a module in C. In the C module, I need to store pointers to the arrays, so I don't have to make a copy for each array it receives from python.
I found that if I reuse the same variable name to create the array, the pointer's values in C program will be lost next time the variable is reassigned.
- for line in file:
- myarray=create an int array from line
'myarray' is reused to create a new array for each line, however I see that the data in myarray in previous loops (which is stored in C program) is destroyed.
To avoid this, I create a python list that appends each 'myarray' instances, and thus are not overwritten. Is there a better approach to avoid this?
Thanks in advance!
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
More information about the Numpy-discussion