Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue15582] Enhance inspect.getdoc to follow inheritance chains

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Aug 7, 2012, 7:52 PM

Post #1 of 3 (53 views)
Permalink
[issue15582] Enhance inspect.getdoc to follow inheritance chains

New submission from Nick Coghlan:

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)

----------
components: Library (Lib)
messages: 167654
nosy: eric.snow, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Enhance inspect.getdoc to follow inheritance chains
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15582>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 8, 2012, 3:34 PM

Post #2 of 3 (46 views)
Permalink
[issue15582] Enhance inspect.getdoc to follow inheritance chains [In reply to]

Changes by Éric Araujo <merwok [at] netwok>:


----------
nosy: +eric.araujo

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15582>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 10, 2012, 12:31 PM

Post #3 of 3 (47 views)
Permalink
[issue15582] Enhance inspect.getdoc to follow inheritance chains [In reply to]

Eric Snow added the comment:

I have just the thing for this, but haven't had a chance to put a patch together. I might be able to get to it in the next week if Dave "bitey" Beazley isn't too much of a distraction. :)

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15582>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.