On 3 November 2010 19:24, Dag Sverre Seljebotn
<[email protected]> wrote:
> cdef class A:
> cdef Vector obj
> x = delegate_property(obj, 'x')
>
> or similar, without throwing in new syntax. But it may be too late and I
> don't care too much. Remember that "x = property(...)" is already in Python.
>
This looks like an interesting option, especially if it was possible
to write your own reusable "xxxx_property" functions that did "the
right thing" for the particular object/library being wrapped. This
would remove a lot boilerplate code that is normally cut and pasted
for setter/getter functions. So, in a case where the C++ members are
private, but access is provided via camelcase set/get functions,
instead of
property value:
def __get__(self):
return self.obj.getValue()
def __set__(self, int x):
self.obj.setValue(x)
We could write:
x = camelcase_delegate_property(self.obj, 'value')
Brett
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev