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

Could you file a wishlist bug for this?

Thanks,

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to