[IPython-dev] let ipython return parent's class method docstring automatically

Fernando Perez fperez.net at gmail.com
Wed Jul 23 17:59:57 EDT 2008


On Wed, Jul 23, 2008 at 1:11 PM, Ondrej Certik <ondrej at certik.cz> wrote:

> The partent class, in this case Basic, has a nice docstring. The thing
> is, that the Basic class has the docstring, but the child classes
> don't (obviously, because it'd be the same).
> What is the best way to handle this?
>
> We can see two possibilities:
>
> 1) patch ipython to return parent's (or parent's parent's) docstring.
> I checked that and the patch would be just a few lines of code in
> OInspect.py

I think this is a fairly generic problem, that of children who
override parent  methods but don't rewrite the docstrings.  So I'd be
happy with ipython making the user's life easier out of the box,
though I think in this case we should say something like:

Docstring : [extracted from parent class foo.bar.baz]
blah...

so users are aware that they're reading the parent's docstring, just
in case there are small inconsistencies the developer forgot to
document.

How does this sound?

Cheers,

f



More information about the IPython-dev mailing list