On Thu, 2010-01-21 at 09:10 -0500, Ng, Enrico wrote:
> I had hoped that there was something simple after seeing the numeric part in 
> the documentation.

Well, if you're content with a 1-D array and speed isn't a big issue,
you can just copy the elements of your array into a Python list like
this:

boost::python::list py_get_data() {
    boost::python::list r;
    for (int n=0; n<IMAGE_SIZE; ++n) {
        r.append(get_data()[n]);
    }
    return r;
}

If you want two dimensions, you could make a list-of-lists.
I don't think there's any way to get a C array into a Python object
without lots of explicit copying aside from using numpy.


Jim Bosch


_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to