[Cython] buffer syntax vs. memory view syntax (was: Re: checking for "None" in nogil function)

Stefan Behnel stefan_ml at behnel.de
Mon May 7 16:16:32 CEST 2012

Stefan Behnel, 07.05.2012 15:04:
> Dag Sverre Seljebotn, 07.05.2012 13:48:
>> BTW, with the coming of memoryviews, me and Mark talked about just
>> deprecating the "mytype[...]" meaning buffers, and rather treat it as
>> np.ndarray, array.array etc. being some sort of "template types". That is,
>> we disallow "object[int]" and require some special declarations in the
>> relevant pxd files.
> Hmm, yes, it's unfortunate that we have two different types of syntax now,
> one that declares the item type before the brackets and one that declares
> it afterwards.

I actually think this merits some more discussion. Should we consider the
buffer interface syntax deprecated and focus on the memory view syntax?

The words-to-punctuation ratio of the latter may hurt the eyes when
encountering it unprepared, but at least it doesn't require two type names,
of which the one before the brackets (i.e. "object") is mostly useless.
(Although it does reflect the notion that we are dealing with an object
here ...)


More information about the cython-devel mailing list