Override a method but inherit the docstring
Jean-Michel Pichavant
jeanmichel at sequans.com
Tue Jul 28 05:33:43 EDT 2009
Shai wrote:
> On Jul 27, 5:05 pm, Jean-Michel Pichavant <jeanmic... at sequans.com>
> wrote:
>
>> Ben Finney wrote:
>>
>>> The docstring for ‘FooGonk.frobnicate’ is, intentionally, perfectly
>>> applicable to the ‘BarGonk.frobnicate’ method also. Yet in overriding
>>> the method, the original docstring is not associated with it.
>>>
>> I've also tried within the python interpreter, and it can perfectly
>> solve docstring inheritance. So why would you explicitly assign
>> docstring to child methods ?
>>
>>
>
> What do you mean by "can perfectly solve docstring inheritance" ?
>
> After the following,
>
> class Foo(object):
> def foo(self):
> "Frobber"
> pass
>
> class Bar(Foo):
> def foo(self):
> pass
>
> help(Bar.foo) does not display "Frobber" on my interpreter.
>
>
You're right. I must have made some dumb mistake. So interpreters do not
solve docstring inheritance, Epydoc does.
JM
More information about the Python-list
mailing list