diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2002-09-15 22:02:58 (GMT) |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2002-09-15 22:02:58 (GMT) |
commit | 908aece9f755e4418c19c26b036949b19b2162d3 (patch) | |
tree | 76aa7ef5babf2266d25bb72418d5936c13c1dd03 /Lib/idlelib/CallTips.py | |
parent | e72f05d5fb5b36400a5470a8420bbed302029839 (diff) | |
download | cpython-908aece9f755e4418c19c26b036949b19b2162d3.zip cpython-908aece9f755e4418c19c26b036949b19b2162d3.tar.gz cpython-908aece9f755e4418c19c26b036949b19b2162d3.tar.bz2 |
Merge Py Idle changes
Rev 1.9
Improve handling of docstrings. I had feared this was a case of
introspection incompatibility, but in fact it's just that calltips
always gave up on a docstring that started with a newline (but
didn't realize they were giving up <wink>).
Rev 1.10
(already merged)
Rev 1.11
(whitespace normalization, skip this time)
Rev 1.12
Remove unnecessary imports
Diffstat (limited to 'Lib/idlelib/CallTips.py')
-rw-r--r-- | Lib/idlelib/CallTips.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Lib/idlelib/CallTips.py b/Lib/idlelib/CallTips.py index 82890cb..e90da49 100644 --- a/Lib/idlelib/CallTips.py +++ b/Lib/idlelib/CallTips.py @@ -2,7 +2,6 @@ # displays parameter information as you open parens. import string -import sys import types class CallTips: @@ -128,16 +127,21 @@ def get_arg_text(ob): items.append("...") if fob.func_code.co_flags & 0x8: items.append("***") - argText = string.join(items , ", ") + argText = ", ".join(items) argText = "(%s)" % argText except: pass # See if we can use the docstring - if hasattr(ob, "__doc__") and ob.__doc__: - pos = string.find(ob.__doc__, "\n") - if pos<0 or pos>70: pos=70 - if argText: argText = argText + "\n" - argText = argText + ob.__doc__[:pos] + doc = getattr(ob, "__doc__", "") + if doc: + while doc[:1] in " \t\n": + doc = doc[1:] + pos = doc.find("\n") + if pos < 0 or pos > 70: + pos = 70 + if argText: + argText += "\n" + argText += doc[:pos] return argText |