Dag Sverre Seljebotn wrote: > Robert wrote: >> I've put a array.pxd here: >> http://trac.cython.org/cython_trac/ticket/314 >> >> -- >> Cython direct interface to Python's array.array type (builtin module). >> >> * 1D contiguous data view >> * 2D views - contigious or [x,y] transposed/strided >> * tools for fast array creation, maximum C-speed and handiness >> * suitable as allround light weight auto-array within Cython >> code too >> >> See also: array_example.pyx and doc strings >> -- >> >> Tests needed. just used it in 2.6 so far. > > Wow, great! That's a lot more sophistication than I imagined in there :-)
Looking a bit more, I wonder if the view2D-functionality fits within a Cython version of the pxd (it is, and needs to be by its nature, a bit hackish). Perhaps it could be reintroduced later as a wrapper class or subclass of array.array. Another possibility long-term would be somehow adding a "view with a different shape"-functionality to Cython itself. Perhaps incorporated in http://wiki.cython.org/enhancements/buffersyntax somehow -- perhaps cdef int[:] arr1d = contigarray(10) cdef int[:,:] arr2d = <int[0:5,0:2]>arr1d # ok since 5*2==10 -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
