how to inherit docstrings?

Eric Snow ericsnowcurrently at gmail.com
Fri Jun 10 00:41:12 EDT 2011


On Thu, Jun 9, 2011 at 9:59 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> On 6/9/2011 9:12 PM, Carl Banks wrote:
>
>> Presumably, the reason you are overriding a method in a subclass is to
>> change its behavior; I'd expect an inherited docstring to be inaccurate more
>> often than not.  So I'd be -1 on automatically inheriting them.
>>
>> However, I'd be +1 easily on a little help from the language to explicitly
>> request to inherit the docstring.
>
> An empty docstring "" could be interpreted as 'ditto' ;-)
> It would be useless otherwise.
>

I kind of like that.  The only catch is for cases out there where
someone used an empty string.  Then it would change the behavior,
maybe.  But how uncommon that is, not sure.  I would guess pretty
uncommon.

Whole implicitly inherit idea would require the empty docstring to say
don't do it.  With your idea you easily, clearly, and explicitly
indicate that you want the inheritance activated.  That would work for
me.

-eric

> --
> Terry Jan Reedy
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list