You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IDLE - Make full docstring visible with CallTips #45691
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/terryjreedy'closed_at=Nonecreated_at=<Date2007-10-28.02:59:54.504>labels= ['expert-IDLE', 'type-feature', '3.10']
title='IDLE - CallTips enhancement - show full doc-string in new window'updated_at=<Date2020-06-06.15:58:56.784>user='https://github.com/taleinat'
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.
However, it isn't fully baked. Please test more
before submitting patches. Try to break them on
corner cases.
importCallTipsCallTips.CallTips(
AttributeError: 'NoneType' object has no attribute
'splitlines'
deffoo():
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?
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.
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.
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...
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.
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?
Calltips will be rewritten for 3.5, maybe 3.4 in bpo-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.
I am not sure what to do with this. The addition of squeezer to Shell and ability to expand into textview makes this a bit less needed. It would have to be rewritten. It seems big, but a large part is revision of tests, which have since been moved to unittests in separate test files.
changed the title [-]IDLE - CallTips enhancement - show full doc-string in new window[/-][+]IDLE - Make full docstring visible with CallTips[/+]on May 20, 2022
Activity
taleinat commentedon Oct 28, 2007
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.
kbkaiser commentedon Dec 12, 2007
This is very useful!
However, it isn't fully baked. Please test more
before submitting patches. Try to break them on
corner cases.
AttributeError: 'NoneType' object has no attribute
'splitlines'
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?
taleinat commentedon Dec 13, 2007
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.
taleinat commentedon Dec 14, 2007
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:
<object>.im_func where needed and formatting doc-strings appropriately
old-style classes
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.
taleinat commentedon Dec 14, 2007
Now for CallTipWindow.py:
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.
taleinat commentedon Dec 14, 2007
(bah, sorry for the mess, use the patch files from the later hour)
kbkaiser commentedon Dec 26, 2007
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.
taleinat commentedon Dec 27, 2007
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...
kbkaiser commentedon Mar 30, 2009
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.
BreamoreBoy commentedon Sep 18, 2010
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?
kbkaiser commentedon May 10, 2011
Rejecting for now, out of date, doesn't apply, not single topic.
terryjreedy commentedon Mar 17, 2014
Calltips will be rewritten for 3.5, maybe 3.4 in bpo-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.
terryjreedy commentedon Jun 6, 2020
I am not sure what to do with this. The addition of squeezer to Shell and ability to expand into textview makes this a bit less needed. It would have to be rewritten. It seems big, but a large part is revision of tests, which have since been moved to unittests in separate test files.
erlend-aasland commentedon May 20, 2022
Sounds like this is a candidate for the
pending(close) label.taleinat commentedon May 20, 2022
@terryjreedy re-opened this and he's still the main developer of IDLE, so I think he should decide whether to reject this feature suggestion.
erlend-aasland commentedon May 20, 2022
Absolutely, that's why I didn't add the label ;)
[-]IDLE - CallTips enhancement - show full doc-string in new window[/-][+]IDLE - Make full docstring visible with CallTips[/+]