[Python-ideas] inheriting docstrings and mutable docstings for classes

Eric Snow ericsnowcurrently at gmail.com
Fri Jun 10 03:45:07 CEST 2011


On Thu, Jun 9, 2011 at 7:05 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Fri, Jun 10, 2011 at 9:54 AM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
>> I'm +1 on having __doc__ be inherited.
>
> -1. Subclasses are not the same thing as the original class so
> docstring inheritance should be requested explicitly.
>

Yeah, this one was mostly auxiliary to my main concern, __doc__
mutability for classes.  Other than doctests and documentation/help(),
I haven't used docstrings for much so the idea of it did not seem like
a big deal.  I certainly find myself inheriting docstrings from my
abstract base classes explicitly all the time so that help() will show
the info that is still applicable.

> Agreed that docstrings should be writeable after the fact, though
> (e.g. functions already work that way - functools.wraps wouldn't work
> otherwise).
>

Would this be a very controversial change?  I ask because it's been
this way since 2.2 and no one's changed it.  Thanks.

-eric

> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
>



More information about the Python-ideas mailing list