Stefan Behnel wrote:
> Hi,
>
> Jason Evans wrote:
>> Is there any reasonable way to attach docstrings to 'cdef public'
>> attributes?
>
> I'm not aware of any, but I miss that feature, too.
>
>
>> The following does not work:
>>
>> cdef class Spam:
>> cdef public int spam:
>> """
>> Docstring for spam.
>> """
>
> This is not a suitable syntax, as we might allow default values for
> attributes one day, as in
>
> cdef public int spam = 1
>
> Putting the docstring before the declaration doesn't work with Python's
> syntax either.
>
> I'm more in favour of a decorator as a potential future syntax:
>
> @cython.docstring("The infamous spam number")
> cdef public int spam = 1
How about introducing a Pythonic syntax for the whole construct, a la
"property"?
spam = cython.cproperty(type=cython.int, init=1, doc="The infamous spam
number")
--
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev