[Cython] Buffer default options
Stefan Behnel
stefan_ml at behnel.de
Wed Jul 30 19:32:50 CEST 2008
Hi,
Dag Sverre Seljebotn wrote:
> I'm thinking about letting the class author specify default buffer
> options. Something like this:
>
> cdef extern class Image ...:
> __cythonbufferdefaults__ = {'ndim' : 2}
> __cythonbuffermandatory__ = {'dtype': unsigned char, indirect=True}
> __cythonbufferalways__ = True
I think default buffer options (mainly a default buffer layout) makes sense in
general. It's basically saying "when I return a buffer, it will look like this".
I wonder about the syntax, though. Wouldn't one special name + a couple of
keyword arguments be enough?
What about specifying it like this:
cdef extern class Image ...:
buffer[...buffer args...] __getbuffer__(...)
?
Stefan
More information about the Cython-dev
mailing list