On Wed, Dec 10, 2008 at 6:10 PM, Stefan Behnel <[EMAIL PROTECTED]> wrote: > David Cournapeau wrote: >> On Wed, Dec 10, 2008 at 5:35 PM, Stefan Behnel wrote: >>> 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 > > So, to construct an instance of a class, you would write > > yo = Yo.__init__(...)
No :) > > is it that what you are saying? I meant that for a class, I find both class and __init__ docstrings useful. In particular, I prefer not to write any signature in the docstring, which means in that case I don't have the information at all. > > As you can see, the docstring of __init__() is fine, but the class > docstring isn't. Extension classes behave like Python builtins (or vice > versa). Their special methods simply don't have a docstring (try > tuple.__init__.__doc__, for example). That's why the standard docstring > refers to the class docstring. Ah, that explains it. I have never really look into the doc of builtins - which are rarely built from __init__ now that I think about it - which explains my surprise. Still, I would prefer to have at least the signature of __init__ (for default arguments), but I guess my only option is to use a pure python class wrapper, in that case, David _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
