diff -r f35514dfadf8 Lib/pydoc.py
--- a/Lib/pydoc.py Thu Oct 20 02:13:23 2011 +0800
+++ b/Lib/pydoc.py Thu Oct 20 02:56:08 2011 +0200
@@ -549,10 +549,16 @@ class HTMLDoc(Doc):
elif pep:
url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
results.append('%s' % (url, escape(all)))
+ elif selfdot:
+ # If what follows to 'self.' is a left parenthesis we have
+ # matched a method, so a link is added. Otherwise, the
+ # match is an instance attribute, rendered as strong text.
+ if text[end:end+1] == '(':
+ results.append('self.' + self.namelink(name, methods))
+ else:
+ results.append('self.%s' % name)
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
- elif selfdot:
- results.append('self.%s' % name)
else:
results.append(self.namelink(name, classes))
here = end