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

Mark Adam dreamingforward at gmail.com
Sat Aug 25 02:10:23 CEST 2012


On Thu, Jun 9, 2011 at 8: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.
>
> Hmm, subclasses are supposed to represent an IS-A relationship in my
oldschool OOP books, typically a specialization of a more general (ie.
abstract) outer class.   The multiple-inheritance case does make things a
bit more sloppy, but then this problem has already been resolved by the
BDFL via MRO, the same could probably apply with docstrings, with the user
updating or using a blank docstring when that general rule doesn't work.

In any case, I found myself wanting this auto-inheritance for easier
testing with doctest.  I don't want my subclasses to mess up invariants in
my parent classes, and if the doctests were inherited this would be easy to
check.

Just my (late) 2 cents worth after examining the current python issues list.

mark
Sorry for any formatting problems, this is a forward after accidently
replying only to ncoghlan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120824/a4dd405a/attachment.html>


More information about the Python-ideas mailing list