[Cython] -dagss merge? + what next
Stefan Behnel
stefan_ml at behnel.de
Wed Jul 30 08:05:35 CEST 2008
Hi,
Robert Bradshaw wrote:
> On Jul 29, 2008, at 12:56 PM, Dag Sverre Seljebotn wrote:
>>>> - shape(buf)
>>>> - buffer(buf), strides(buf), suboffsets(buf)
>>>> - ndim(buf)
>
> OK, for some reason I was missing the fact that you were cimporting
> them (I thought you were suggesting they be builtins like len). I
> think it should somehow be clear that these operate on buffers,
> either by placing them in cython.buffer or calling them buffer_shape,
> etc. (I prefer the former).
+1, this looks perfectly fine to me:
from cython.buffer cimport shape
or
from cython cimport buffer
buffer.shape(...)
Although
from cython cimport buffer
buffer.buffer(...)
looks a little funny. Maybe "buffer.plainbuffer()" is clearer - "buffer" isn't
the struct field name anyway.
>> - cython.unchecked_getitem(buf, i, j) and cython.unchecked_cast(...)
>> - with cython.noboundschecking: ...
>> - @cython.noboundschecking
>> def f(): ...
>>
>> etc. Also it could be a primary vehicle (in a future far off) of
>> making
>> Cython more namespace-compatible with Python:
>>
>> with cython.nogil:
>
> Yeah, I like this general direction, though your first example is a
> bit verbose.
It's pretty explicit, though. I don't think it would help readability if you
made it shorter. And if users really think they are smart enough, there's always
from cython cimport unchecked_getitem as ugi
:)
Stefan
More information about the Cython-dev
mailing list