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

Ludwig Schwardt ludwig.schwardt at gmail.com
Wed Apr 20 03:10:20 EDT 2011


>From what I can tell, the patch mentioned below never made it home...
It would be a really nice feature to have!


On Wed, Jul 23, 2008 at 17:25 PM, Ondrej Certik <ondrej at certik.cz> wrote:
>On Wed, Jul 23, 2008 at 11:59 PM, Fernando Perez <fperez.net at gmail.com> wrote:
>> On Wed, Jul 23, 2008 at 1:11 PM, Ondrej Certik <ondrej at certik.cz> wrote:
>>> The parent 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?
>I'll send a patch.

More information about the IPython-dev mailing list