Skip to content

IDLE - Make full docstring visible with CallTips #45691

Open

Description

@taleinat
BPO 1350
Nosy @terryjreedy
Dependencies
  • bpo-19903: Idle: Use inspect.signature for calltips
  • Files
  • IDLE_CallTips.071214.patch
  • 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 = None
    created_at = <Date 2007-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 = <Date 2020-06-06.15:58:56.784>
    user = 'https://github.com/taleinat'

    bugs.python.org fields:

    activity = <Date 2020-06-06.15:58:56.784>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2007-10-28.02:59:54.504>
    creator = 'taleinat'
    dependencies = ['19903']
    files = ['8959']
    hgrepos = []
    issue_num = 1350
    keywords = ['patch']
    message_count = 13.0
    messages = ['56876', '58481', '58531', '58641', '58642', '58643', '59005', '59009', '84550', '116784', '135736', '213879', '370829']
    nosy_count = 1.0
    nosy_names = ['terry.reedy']
    pr_nums = []
    priority = 'low'
    resolution = None
    stage = 'test needed'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1350'
    versions = ['Python 3.10']

    Activity

    1. taleinat commented on Oct 28, 2007

      @taleinat
      ContributorAuthor

      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.

    2. kbkaiser commented on Dec 12, 2007

      @kbkaiser
      Contributor

      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?

    3. self-assigned this
      on Dec 12, 2007
    4. taleinat commented on Dec 13, 2007

      @taleinat
      ContributorAuthor

      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.

    5. taleinat commented on Dec 14, 2007

      @taleinat
      ContributorAuthor

      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.

    6. taleinat commented on Dec 14, 2007

      @taleinat
      ContributorAuthor

      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.

    7. taleinat commented on Dec 14, 2007

      @taleinat
      ContributorAuthor

      (bah, sorry for the mess, use the patch files from the later hour)

    8. kbkaiser commented on Dec 26, 2007

      @kbkaiser
      Contributor

      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.

    9. taleinat commented on Dec 27, 2007

      @taleinat
      ContributorAuthor

      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...

    10. kbkaiser commented on Mar 30, 2009

      @kbkaiser
      Contributor

      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.

    11. BreamoreBoy commented on Sep 18, 2010

      BreamoreBoymannequin
      Mannequin

      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?

    12. kbkaiser commented on May 10, 2011

      @kbkaiser
      Contributor

      Rejecting for now, out of date, doesn't apply, not single topic.

    13. terryjreedy commented on Mar 17, 2014

      @terryjreedy
      Member

      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.

    14. terryjreedy commented on Jun 6, 2020

      @terryjreedy
      Member

      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.

    15. transferred this issue fromon Apr 10, 2022
    16. erlend-aasland commented on May 20, 2022

      @erlend-aasland
      Contributor

      I am not sure what to do with this.

      Sounds like this is a candidate for the pending (close) label.

    17. taleinat commented on May 20, 2022

      @taleinat
      ContributorAuthor

      @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.

    18. erlend-aasland commented on May 20, 2022

      @erlend-aasland
      Contributor

      Absolutely, that's why I didn't add the label ;)

    19. changed the title [-]IDLE - CallTips enhancement - show full doc-string in new window[/-] [+]IDLE - Make full docstring visible with CallTips[/+] on May 20, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions