[Cython] array.array and PIL directly ?
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Thu May 14 18:19:03 CEST 2009
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 :-)
Tests would be needed before inclusion though, as you already have demo
code it should be easy to add. Given that someone writes tests for this
(perhaps I even do it myself if I need to) I think it's safe to say that
this can enter Cython (in 0.11.3 or 0.12).
Small nitpick: It would be good if you could use /* */ comments in the
.h-file as // is not portable.
> PS: For 2.3 a need arose for conditional compilation within the pxd.
> http://docs.cython.org/docs/language_basics.html#conditional-compilation
> doesn't seem to allow comparison against the python version so far? )
The problem is that the Python that runs Cython is not always the Python
that the C file is compiled against...
I think just dropping Py 2.3 for this feature would be OK.
--
Dag Sverre
More information about the Cython-dev
mailing list