[Cython] Python array support (#113)

mark florisson markflorisson88 at gmail.com
Sun May 6 11:07:14 CEST 2012


On 6 May 2012 10:05, Stefan Behnel <stefan_ml at behnel.de> wrote:
> mark florisson, 06.05.2012 10:56:
>> On 5 May 2012 20:50, Stefan Behnel wrote:
>>>>   https://github.com/cython/cython/pull/113
>>>
>>> This looks ok to me now. There have been objections back when we discussed
>>> the initial patch for array.array support, so what do you think about
>>> merging this in?
>>
>> Great, I think it can be quite useful for some people. I think only
>> some documentation is missing.
>>
>> Also, very minor complaint, the way it allocates shape, strides and
>> the format string in __getbuffer__ is weird and complicated for no
>> good reason.
>
> Maybe the reason is just that it wasn't written by you. ;)
>
> I take it that it's best to merge this pull request then, and to further
> fix it up afterwards.
>

Definitely, +1.

>> I think it's better to declare two Py_ssize_t scalars or
>> one-sized arrays as class attributes and one char[2] array, and use
>> those (then you can also get rid of __releasebuffer__).
>
> Yes, that would be good. Note that itemsize is specifically designed so
> that it can be pointed to by strides for 1D arrays, and I guess shape can
> similarly just point to ob_size.
>
> Stefan
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> http://mail.python.org/mailman/listinfo/cython-devel


More information about the cython-devel mailing list