exposing C array to python namespace: NumPy and array module.
bpeng at rice.edu
Sat Jan 1 11:27:50 EST 2005
Craig Ringer wrote:
> On Sat, 2005-01-01 at 08:18, Bo Peng wrote:
>>Python's array module is built-in, easy to use, but *without* a
>>FromLenAndData function! Even the buffer interface provides only 'get
>>buffer' but no 'set buffer' functions. Could anyone tell me how I can
>>create an array object from existing data?
> Python has no array objects in the core language, only lists. The
> distinction is important when discussing numarray etc, because Python
> lists and NumPy etc arrays are very different.
Thank you very much for the detailed reply!
Sorry if I was not clear enough. I was talking about the differece
between python array module
(http://docs.python.org/lib/module-array.html, Modules/arraymodule.c in
the source tree) and NumPy array. They both use C-style memory block
arrangement for efficient memory access. While NumPy has both, the array
module is designed to be used purely in Python so there is no header
file and no function to build an array from a pointer.
One of the methods you suggested (creating a new type) already
implemented in arraymodule.c. I am not sure if it is appropriate to add
the file into my project and add a 'CreateFromLenAndBuf' function.
More information about the Python-list