[Python-checkins] CVS: python/dist/src/Tools/idle CallTips.py,1.8,1.9

Tim Peters tim_one@users.sourceforge.net
Sat, 15 Sep 2001 19:19:51 -0700


Update of /cvsroot/python/python/dist/src/Tools/idle
In directory usw-pr-cvs1:/tmp/cvs-serv12831/python/Tools/idle

Modified Files:
	CallTips.py 
Log Message:
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>).


Index: CallTips.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/CallTips.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** CallTips.py	2001/01/17 08:48:39	1.8
--- CallTips.py	2001/09/16 02:19:49	1.9
***************
*** 144,152 ****
                  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]
  
      return argText
--- 144,157 ----
                  pass
          # See if we can use the docstring
!         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