On Wed, Dec 10, 2008 at 5:35 PM, Stefan Behnel <[EMAIL PROTECTED]> wrote: > David Cournapeau wrote: >> Is it possible to include docstring in a cdef class exactly as it >> would work for python classes, or do I have to use python wrappers >> around the cython class ? As an example: >> >> cdef Yo: >> def __init__(selg, arg1='arg1'): >> "Some doc" >> >> The Yo.__init__.__doc__ is not "some doc", and I can't get the >> signature in ipython. Is this expected, or am I doing something wrong >> here ? > > I find this unexpected, too. However, have you tried putting the docstring > where it actually belongs? As in > > cdef class Yo: > "Some doc"
Hm, why should the __init__ method belong to the class string ? Those are different, in my mind: the Yo.__doc__ tells about the Yo class purpose, and the Yo.__init__.__doc__ should give details about the construction (arguments, + signature in the case of ipython advanced help options). The class docstring does work, though; the __init__ is: x.__init__(...) initializes x; see x.__class__.__doc__ for signature And Yo.__class__.__doc__ is: "type(object) -> the object's type\ntype(name, bases, dict) -> a new type" David _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
