This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients eric.snow, ncoghlan
Date 2012-08-08.02:52:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1344394334.01.0.280520797106.issue15582@psf.upfronthosting.co.za>
In-reply-to
Content
Currently, if you override a method from a base class, the docstring is not inherited, even if it remains accurate.

This issue proposes an enhancement to inspect.getdoc() that allows the docstring to be retrieved from the inheritance hierarchy in the case where it is not overridden in the subclass by providing an explicit docstring.

Specifically, in the case where obj.__doc__ is None, and either the first parameter is a bound method, or a class object is passed in as the second parameter, inspect.getdoc will search the MRO based on obj.__name__ until it finds an attribute with a non-None __doc__ value.

(In Python 2, this could have been automatic for both bound and unbound methods. Unfortunately, there are no unbound methods in Python 3, so the second parameter is needed to handle the unbound method case)
History
Date User Action Args
2012-08-08 02:52:14ncoghlansetrecipients: + ncoghlan, eric.snow
2012-08-08 02:52:14ncoghlansetmessageid: <1344394334.01.0.280520797106.issue15582@psf.upfronthosting.co.za>
2012-08-08 02:52:13ncoghlanlinkissue15582 messages
2012-08-08 02:52:12ncoghlancreate