Override a method but inherit the docstring

Shai shai at platonix.com
Mon Jul 27 17:15:00 EDT 2009

On Jul 27, 5:05 pm, Jean-Michel Pichavant <jeanmic... at sequans.com>
> 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):

class Bar(Foo):
    def foo(self):

help(Bar.foo) does not display "Frobber" on my interpreter.

More information about the Python-list mailing list