Dag Sverre Seljebotn wrote:
> Stefan Behnel wrote:
>> 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?
>
> [...] My preference now would be for __cythonbufferopts__ with a
> tuple or dict giving "defaults", "mandatory" etc.

Something like that, yes. It could reuse the existing compile-time "DEF"
infrastructure, thus resulting in a real tuple that can be evaluated at
parse time and disappear later on. Not sure if a dict works here, though.

Stefan

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to