From: Tim Peters Date: Tue, 25 Sep 2001 00:01:06 +0000 (+0000) Subject: GUI mode now displays useful stuff for properties. This is usually better X-Git-Tag: v2.2.1c1~1641 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e767d19e00690435a0edc257f2ac33fc7fca860;p=python GUI mode now displays useful stuff for properties. This is usually better than text mode, since here we can hyperlink from the getter etc methods back to their definitions. --- diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 4bf194068d..c3f33a094c 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -636,16 +636,26 @@ TT { font-family: lucidatypewriter, lucida console, courier } push('\n') return attrs - # pydoc can't make any reasonable sense of properties on its own, - # and it doesn't appear that the getter, setter and del'er methods - # are discoverable. For now, just pump out their names. def spillproperties(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: - push('
%s
\n' % name) + push('
%s
\n' % name) + if value.__doc__ is not None: + doc = self.markup(value.__doc__, self.preformat, + funcs, classes, mdict) + push('
%s
\n' % doc) + for attr, tag in [("fset", " setter"), + ("fget", " getter"), + ("fdel", " deleter")]: + func = getattr(value, attr) + if func is not None: + base = self.document(func, name + tag, mod, + funcs, classes, mdict, object) + push('
%s
\n' % base) + push('
\n') return attrs def spilldata(msg, attrs, predicate):