On Jul 29, 2008, at 1:00 PM, Dag Sverre Seljebotn wrote:
> There's a lot of email today but as I finished one part I'm staking
> out
> the course again.
>
> 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
>
> [1]
>
> I think this makes a lot of sense, as the author of the Image class
> might export exactly this kind of buffer and nothing else. With the
> above settings, one would automatically get efficient indexing on all
> "cdef Image" instances.
>
> NumPy is kind of special in the flexibility it provides, but even
> there,
> setting indirect=False can provide a speedup transparently. Once the
> indirect option is implemented at all, that is :-) but that *must*
> happen to make NumPy as efficient as possible.
>
> As for priority, I guess this is below most of what I've talked
> about so
> far. Though it might suddenly look like a low hanging fruit that I go
> for when I need a break from other stuff.
>
> [1] (Well, I consider custom parsing for that last line better than
> inventing a wholly new syntax...and we've been talking about new
> Python-style type references as well, which fits in here)
This almost seems to magical for me, if one wants to use a buffer
perhaps it is better to be explicit. But I'm curious to hear what
other people think.
- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev