summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-09-25 00:01:06 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-09-25 00:01:06 (GMT)
commit3e767d19e00690435a0edc257f2ac33fc7fca860 (patch)
treed513b35c146b1c00f1a9b7abe34ed3e1b51f5ec2
parentf4aad8eb28606a7cfa0266a1f2c28c003e8cd36e (diff)
downloadcpython-3e767d19e00690435a0edc257f2ac33fc7fca860.zip
cpython-3e767d19e00690435a0edc257f2ac33fc7fca860.tar.gz
cpython-3e767d19e00690435a0edc257f2ac33fc7fca860.tar.bz2
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.
-rwxr-xr-xLib/pydoc.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 4bf1940..c3f33a0 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('<dl><dt><strong>%s</strong></dl>\n' % name)
+ push('<dl><dt><strong>%s</strong></dt>\n' % name)
+ if value.__doc__ is not None:
+ doc = self.markup(value.__doc__, self.preformat,
+ funcs, classes, mdict)
+ push('<dd><small><tt>%s</tt></small></dd>\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('<dd>%s</dd>\n' % base)
+ push('</dl>\n')
return attrs
def spilldata(msg, attrs, predicate):