On Sat, 2005-01-01 at 10:27 -0600, Bo Peng wrote: > 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.
Thanks for clarifying that - I had misunderstood your reference to arraymodule.c . I guess the core language doesn't have an array type, but as there's a standard lib module that does (I'd forgotten it was there), it hardly matters. It would seem sensible to extend that module with a C API for mapping an existing array. That would be a rather handy thing to have in the standard library. > 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. That sounds like a reasonable approach to me, but I'm hardly an expert. The code's license permits you to do so, and it's hardly worth repeating the work if you don't have to. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list