[Cython] Enhancing "ctyepdef class numpy.ndarray" with getter properties
Matti Picus
matti.picus at gmail.com
Fri Sep 28 04:11:10 EDT 2018
On 28/09/18 01:20, Robert Bradshaw wrote:
> On Thu, Sep 27, 2018 at 11:36 PM Matti Picus <matti.picus at gmail.com
> <mailto:matti.picus at gmail.com>> wrote:
>
> The problem is that when one reads
>
> cdef int aaa bbbb
>
> there's no indication as to the meaning of this. We also want to be
> sure to disallow this syntax everywhere but this one context. On the
> other hand the quotation syntax
>
> cdef int aaa "bbb"
>
> already has (widespread) meaning of establishing a C alias of the name
> in question which is essentially what we're trying to do here.
>
> I'm still, however, leaning towards the @property syntax (which we
> could allow for non-extern cdef classes as well).
>
> - Robert
>
>
Using "PyArray_DIMS" with quotes but without parentheses would indeed be
confusing to users and difficult to implement, so "PyArray_DIMS(*)"
where the * is TBD seem nicer.
It sounds like the jury is still out. In order to compare the solutions,
I will move forward with the @property decorator syntax, but to keep it
simple I will start small: only getters and specifically for
CFuncDefNodes. Then if you still want to look at the other option I will
turn my "experiment into a PR.
Matti
More information about the cython-devel
mailing list