classification
Title: IDLE - CallTips enhancement - show full doc-string in new window
Type: enhancement Stage: test needed
Components: IDLE Versions: Python 3.5
process
Status: open Resolution:
Dependencies: 19903 Superseder:
Assigned To: terry.reedy Nosy List: Saimadhav.Heblikar, gpolo, kbk, markroseman, terry.reedy
Priority: normal Keywords: patch

Created on 2007-10-28 02:59 by taleinat, last changed 2017-09-28 13:17 by BreamoreBoy.

Files
File name Uploaded Description Edit
IDLE_CallTips.071214.patch taleinat, 2007-12-14 23:33 review
Messages (12)
msg56876 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2007-10-28 02:59
This (relatively speaking) simple patch allows the full doc-string of a
callable to be displayed in a textView window. Once a call-tip is being
displayed, hitting one of the keys which is bound to the
force-open-calltip virtual event (Control-backslash by default) opens
the new window. If there is no extra documentation to be shown (in
addition to what is already shown in the call-tip), the window is not
displayed.
msg58481 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2007-12-12 02:13
This is very useful!

However, it isn't fully baked.  Please test more
before submitting patches.  Try to break them on
corner cases.

import CallTips
CallTips.CallTips(

AttributeError: 'NoneType' object has no attribute 
'splitlines'

def foo():
    pass

foo(

same error.

There are two conditional blocks which need to go
on separate lines.

The jocular test in CallTipWindow needs to be changed
to avoid needless controversy.  Also, the doc window's
first line isn't quite right.

There may be other issues, but that's as far as I got.

I would like to get this into 2.6a1.  However, I
completely rewrote CallTips.py for 3.0.  I will need
another version of the patch for the latter, can you
supply it once we get 2.6 put to bed?
msg58531 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2007-12-13 13:02
Yes, I admit I haven't tested this very thoroughly. I'll give this some
more time this weekend and submit another patch.

As for 3.0, I'll have to see what you've changed, but I'll gladly work
up a patch based on the newer version.
msg58641 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2007-12-14 23:02
Alrighty then!

Since I had also done some work on CallTips.py since the previous patch,
I've worked up a merged version, including stuff from the py3k version
and better tests.

Changes since the first patch:
* add support for callable instances (e.g. __call__)
* use inspect, which does the hackish stuff for us, such as using
<object>.im_func where needed and formatting doc-strings appropriately
* use isinstance instead of type checking, like in the py3k branch
* rename get_arg_text to get_arg_text_and_doc
* add test cases for callable instances, classmethods, staticmethods and
old-style classes
* rework testing code
* tested extensively (only on WinXP, Python2.5)

I'm attaching a patch relative to the current SVN head, and another one
relative to the current SVN head with the previous patch applied.
msg58642 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2007-12-14 23:33
Now for CallTipWindow.py:

* split conditionals into two lines as requested
* changed the test (took me a while to understand what "controversy" you
were referring to...)

I couldn't find anything wrong with the first line. It is the
function/method signature if it was found, or just the beginning of the
doc-string otherwise. Unless you think the adding the signature (when
possible) is unnecessary/confusing...

The above changes are included in both new patches.
msg58643 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2007-12-14 23:34
(bah, sorry for the mess, use the patch files from the later hour)
msg59005 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2007-12-26 20:36
I deleted the extra files.

You aren't making this easy!  I was expecting a relatively small update to 
the original patch.

Did you backport my 3.0 revision of CallTips.py or did you come up with 
your own version which uses inspect.py?

Right now, the patch includes two unrelated developments, which 
(following 
our normal procedures) wouldn't be combined as you have done.
msg59009 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2007-12-27 12:54
I had a working version which also used inspect before I saw your 3.0
version, but they both use inspect similarly, very straightforward. I
seem to recall only one of the version used inspect to get the doc
string, but I don't remember which one...

Depending on how you divide things, this patch includes more than just
two different developments. But they are interrelated to some extent.
And one of the developments is more rigorous testing, which this version
passes with flying colors.

If you wish, I can try to get another developer or two to test and
review this patch, if that will help somehow. Or anything else that will
help...
msg84550 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2009-03-30 14:30
I think that because of the re-write of CallTips.py for py3k that we 
would need separate patches for 2.7 and 3.1.  I suggest dropping the 
idea of adding the functionality to 2.7 unless OP wants to provide a 
separate patch against TRUNK.  Because of the re-write, svn-merge will 
fail totally unless the rewrite is backported (which would have to be 
done as a separate patch, first.)  Let's forget 2.x for this.

We already are using inspect and the added functionality intended here 
should be implemented as a patch against current py3k HEAD.  This patch 
won't appy.  Also, if there is more new functionality than just the doc 
string window, it should be broken out into separate patches.

The added functionality is useful, but this patch is not the way to go.
msg116784 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-09-18 14:27
From msg84550 "The added functionality is useful, but this patch is not the way to go".  Can this be closed as rejected, would the OP like to supply an updated patch, or what?
msg135736 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2011-05-10 20:03
Rejecting for now, out of date, doesn't apply, not single topic.
msg213879 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-03-17 17:31
Calltips will be rewritten for 3.5, maybe 3.4 in #19903, to use inspect.signature. Once that is done, I would like to revisit this issue, as I agree that it would be useful, and it should be fairly easy. I though of being able to rightclick on the calltip box to ask for more but a key would be fine to start. The current code uses .__doc__ but only after checking that it exists.
    if isinstance(ob_call, types.MethodType):
        doc = ob_call.__doc__
    else:
        doc = getattr(ob, "__doc__", "")
    if doc:
I would not start this until the new code is in place.
History
Date User Action Args
2017-09-28 13:17:11BreamoreBoysetnosy: - BreamoreBoy
2017-09-28 07:00:34taleinatsetnosy: - taleinat
2015-09-18 16:37:17markrosemansetnosy: + markroseman
2014-03-19 12:30:31Saimadhav.Heblikarsetnosy: + Saimadhav.Heblikar
2014-03-17 17:31:04terry.reedysetstatus: closed -> open
priority: low -> normal
dependencies: + Idle: Use inspect.signature for calltips

assignee: kbk -> terry.reedy
versions: + Python 3.5, - Python 3.2
resolution: rejected ->
messages: + msg213879
stage: resolved -> test needed
2011-05-10 20:03:16kbksetstatus: open -> closed
resolution: out of date -> rejected
messages: + msg135736

stage: test needed -> resolved
2010-09-18 14:27:16BreamoreBoysetnosy: + terry.reedy, BreamoreBoy

messages: + msg116784
versions: + Python 3.2, - Python 3.1
2009-04-26 22:22:18ajaksu2setnosy: + gpolo

type: enhancement
stage: test needed
2009-03-30 14:30:14kbksetpriority: low
resolution: out of date
messages: + msg84550

versions: + Python 3.1, - Python 2.6, Python 2.5
2008-06-08 11:46:09taleinatsetfiles: - IDLE_CallTips.071214.incremental.patch
2008-06-08 11:45:01taleinatsetfiles: - IDLE_CallTips.071028.patch
2007-12-27 12:54:32taleinatsetmessages: + msg59009
2007-12-26 20:36:56kbksetmessages: + msg59005
2007-12-17 22:56:59kbksetfiles: - IDLE_CallTips.071214.patch
2007-12-17 22:56:45kbksetfiles: - IDLE_CallTips.071214.incremental.patch
2007-12-14 23:34:52taleinatsetmessages: + msg58643
2007-12-14 23:33:27taleinatsetfiles: + IDLE_CallTips.071214.incremental.patch
2007-12-14 23:33:19taleinatsetfiles: + IDLE_CallTips.071214.patch
messages: + msg58642
2007-12-14 23:02:41taleinatsetfiles: + IDLE_CallTips.071214.incremental.patch
2007-12-14 23:02:32taleinatsetfiles: + IDLE_CallTips.071214.patch
messages: + msg58641
2007-12-13 13:02:17taleinatsetmessages: + msg58531
2007-12-12 02:13:19kbksetassignee: kbk
messages: + msg58481
2007-10-28 07:26:35loewissetkeywords: + patch
2007-10-28 02:59:54taleinatcreate