Robert Bradshaw wrote:
> On Jul 31, 2008, at 1:07 AM, Dag Sverre Seljebotn wrote:
>
>> Stefan Behnel wrote:
>>> 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?
>> In the discussion with Robert we kind of boiled it down to only
>> defaults
>> being needed; at least mandatory has problems and does not really gain
>> anything. My preference now would be for __cythonbufferopts__ with a
>> tuple or dict giving "defaults", "mandatory" etc.
>
> I am for keeping it very simple, so I would propose a single
> dictionary __cythonbufferdefaults__.
>
>> As for "being enough", in syntax discussions pretty much every syntax
>> proposed is possible :-) My personal taste for new syntax is this:
>>
>> a) Extends the existing language grammar as little as possible
>> b) Won't make it harder to get "Python-runnable-Cython-code" in the
>> future,
>> c) Is somewhat Pythonic (see below).
>
> A counter-argument is that if you misspell it, it will silently fail
> to work. (You still have me convinced though.)
Well, this is Python after all :-)
self.finshied = True
--
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev